diff --git a/modern-js/module-tools/404.html b/modern-js/module-tools/404.html index dcac4f90df..9bbddfb5b1 100644 --- a/modern-js/module-tools/404.html +++ b/modern-js/module-tools/404.html @@ -7,7 +7,7 @@ 404 - Modern.js Module - +

404

PAGE NOT FOUND

diff --git a/modern-js/module-tools/api/config/build-config.html b/modern-js/module-tools/api/config/build-config.html index 27f2d1c1fa..4aaf865d13 100644 --- a/modern-js/module-tools/api/config/build-config.html +++ b/modern-js/module-tools/api/config/build-config.html @@ -7,7 +7,7 @@ buildConfig - Modern.js Module - +

buildConfig

@@ -732,8 +732,14 @@

resolve.a

一个 Module ID 被错误的处理成了相对路径,显然这是不符合预期的。

我们想要修复这个问题,但是这可能会破坏已有的项目,因此我们在 2.58.0 版本提供了 resolve.alias 来解决这个问题。 并且 resolve.alias 里移除了 alias 提供的默认值 { "@": "./src"}

-

如果你需要此功能,请使用 resolve.alias, 注意不要与 alias 混用。

+

如果你需要此功能,请使用 resolve.alias

在下一个大版本,resolve.alias 将会取代 alias

+
WARNING
+
    +
  • 注意此配置不要与 alias 混用。
  • +
  • 注意此配置必须标注一个相对路径,例如 { "@": "./src" } 而非 { "@": "src"}
  • +
+

resolve.mainFields

package.json 中,在解析包的入口点时尝试的字段列表。

    diff --git a/modern-js/module-tools/api/config/build-preset.html b/modern-js/module-tools/api/config/build-preset.html index b6a3f272a4..962cc3e026 100644 --- a/modern-js/module-tools/api/config/build-preset.html +++ b/modern-js/module-tools/api/config/build-preset.html @@ -7,7 +7,7 @@ buildPreset - Modern.js Module - +

    buildPreset

    diff --git a/modern-js/module-tools/api/config/dev.html b/modern-js/module-tools/api/config/dev.html index 45a8f8173d..5fa623dc78 100644 --- a/modern-js/module-tools/api/config/dev.html +++ b/modern-js/module-tools/api/config/dev.html @@ -7,7 +7,7 @@ dev - Modern.js Module - +

    dev

    diff --git a/modern-js/module-tools/api/config/plugins.html b/modern-js/module-tools/api/config/plugins.html index 05d20eedc1..ef46df2a42 100644 --- a/modern-js/module-tools/api/config/plugins.html +++ b/modern-js/module-tools/api/config/plugins.html @@ -7,7 +7,7 @@ plugins - Modern.js Module - +

    plugins

    diff --git a/modern-js/module-tools/api/index.html b/modern-js/module-tools/api/index.html index 9a2928bd32..6b9820fb11 100644 --- a/modern-js/module-tools/api/index.html +++ b/modern-js/module-tools/api/index.html @@ -7,7 +7,7 @@ 概览 - Modern.js Module - + diff --git a/modern-js/module-tools/api/plugin-api/plugin-hooks.html b/modern-js/module-tools/api/plugin-api/plugin-hooks.html index 01bf5ec72f..e576ecc2db 100644 --- a/modern-js/module-tools/api/plugin-api/plugin-hooks.html +++ b/modern-js/module-tools/api/plugin-api/plugin-hooks.html @@ -7,7 +7,7 @@ Plugin Hooks - Modern.js Module - +

    Plugin Hooks

    diff --git a/modern-js/module-tools/components/faq-build-exception.html b/modern-js/module-tools/components/faq-build-exception.html index 59d058aa15..b166f501b6 100644 --- a/modern-js/module-tools/components/faq-build-exception.html +++ b/modern-js/module-tools/components/faq-build-exception.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/components/faq-build-other.html b/modern-js/module-tools/components/faq-build-other.html index 29ba593fba..8ee0ec5a36 100644 --- a/modern-js/module-tools/components/faq-build-other.html +++ b/modern-js/module-tools/components/faq-build-other.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/components/faq-build-product.html b/modern-js/module-tools/components/faq-build-product.html index 9a935d244c..6811107829 100644 --- a/modern-js/module-tools/components/faq-build-product.html +++ b/modern-js/module-tools/components/faq-build-product.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/components/faq-storybook.html b/modern-js/module-tools/components/faq-storybook.html index 96b8b5ef35..e43d831d2f 100644 --- a/modern-js/module-tools/components/faq-storybook.html +++ b/modern-js/module-tools/components/faq-storybook.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/components/publish-emo.html b/modern-js/module-tools/components/publish-emo.html index 0db74b3048..55476bbd35 100644 --- a/modern-js/module-tools/components/publish-emo.html +++ b/modern-js/module-tools/components/publish-emo.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/components/register-esbuild-plugin.html b/modern-js/module-tools/components/register-esbuild-plugin.html index a902d02dfe..dc08c1b3cc 100644 --- a/modern-js/module-tools/components/register-esbuild-plugin.html +++ b/modern-js/module-tools/components/register-esbuild-plugin.html @@ -7,7 +7,7 @@ Modern.js Module - +
    modern.config.ts
    import { myEsbuildPlugin } from './myEsbuildPlugin';
    diff --git a/modern-js/module-tools/components/release-module-doc.html b/modern-js/module-tools/components/release-module-doc.html
    index 62262fe859..52f9a1a8b5 100644
    --- a/modern-js/module-tools/components/release-module-doc.html
    +++ b/modern-js/module-tools/components/release-module-doc.html
    @@ -7,7 +7,7 @@
       
       
       Modern.js Module
    -
    +
     
     
       
    diff --git a/modern-js/module-tools/en/api/config/build-config.html b/modern-js/module-tools/en/api/config/build-config.html
    index 9362e183ec..df9cb77434 100644
    --- a/modern-js/module-tools/en/api/config/build-config.html
    +++ b/modern-js/module-tools/en/api/config/build-config.html
    @@ -7,7 +7,7 @@
       
       
       buildConfig - Modern.js Module
    -
    +
     
     
       

    buildConfig

    @@ -738,8 +738,14 @@

    resolve.a

    A Module ID is incorrectly processed as a relative path, which is not expected.

    We want to fix this issue, but it may break existing projects.

    Therefore, in 2.58.0, we provided resolve.alias to solve this problem. Additionally, resolve.alias removed the default value { "@": "./src"} provided by alias.

    -

    If you need this feature, please use resolve.alias and avoid mixing it with alias.

    +

    If you need this feature, please use resolve.alias.

    In the next major version, resolve.alias will replace alias.

    +
    WARNING
    +
      +
    • Note that this configuration should not be mixed with alias.
    • +
    • Ensure that this configuration specifies a relative path, such as { "@": "./src" } rather than { "@": "src"}.
    • +
    +

    resolve.mainFields

    A list of fields in package.json to try when parsing the package entry point.

      diff --git a/modern-js/module-tools/en/api/config/build-preset.html b/modern-js/module-tools/en/api/config/build-preset.html index b254cc4601..67f2298ff0 100644 --- a/modern-js/module-tools/en/api/config/build-preset.html +++ b/modern-js/module-tools/en/api/config/build-preset.html @@ -7,7 +7,7 @@ buildPreset - Modern.js Module - +

      buildPreset

      diff --git a/modern-js/module-tools/en/api/config/dev.html b/modern-js/module-tools/en/api/config/dev.html index de6ccf83f8..09214f8a00 100644 --- a/modern-js/module-tools/en/api/config/dev.html +++ b/modern-js/module-tools/en/api/config/dev.html @@ -7,7 +7,7 @@ dev - Modern.js Module - +

      dev

      diff --git a/modern-js/module-tools/en/api/config/plugins.html b/modern-js/module-tools/en/api/config/plugins.html index e56976fbdf..15134bbbd7 100644 --- a/modern-js/module-tools/en/api/config/plugins.html +++ b/modern-js/module-tools/en/api/config/plugins.html @@ -7,7 +7,7 @@ plugins - Modern.js Module - +

      plugins

      diff --git a/modern-js/module-tools/en/api/index.html b/modern-js/module-tools/en/api/index.html index 8f693f7e8b..77ebcd4b13 100644 --- a/modern-js/module-tools/en/api/index.html +++ b/modern-js/module-tools/en/api/index.html @@ -7,7 +7,7 @@ Overview - Modern.js Module - + diff --git a/modern-js/module-tools/en/api/plugin-api/plugin-hooks.html b/modern-js/module-tools/en/api/plugin-api/plugin-hooks.html index 08197a5781..d0bdc1d2de 100644 --- a/modern-js/module-tools/en/api/plugin-api/plugin-hooks.html +++ b/modern-js/module-tools/en/api/plugin-api/plugin-hooks.html @@ -7,7 +7,7 @@ Plugin Hooks - Modern.js Module - +

      Plugin Hooks

      diff --git a/modern-js/module-tools/en/components/faq-build-exception.html b/modern-js/module-tools/en/components/faq-build-exception.html index c844360658..7d403d351e 100644 --- a/modern-js/module-tools/en/components/faq-build-exception.html +++ b/modern-js/module-tools/en/components/faq-build-exception.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/en/components/faq-build-other.html b/modern-js/module-tools/en/components/faq-build-other.html index 3e341a90b3..e94a240f00 100644 --- a/modern-js/module-tools/en/components/faq-build-other.html +++ b/modern-js/module-tools/en/components/faq-build-other.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/en/components/faq-build-product.html b/modern-js/module-tools/en/components/faq-build-product.html index 3c7ca7a791..310d93992c 100644 --- a/modern-js/module-tools/en/components/faq-build-product.html +++ b/modern-js/module-tools/en/components/faq-build-product.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/en/components/faq-storybook.html b/modern-js/module-tools/en/components/faq-storybook.html index eeaeca3800..dfa860eaf8 100644 --- a/modern-js/module-tools/en/components/faq-storybook.html +++ b/modern-js/module-tools/en/components/faq-storybook.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/en/components/publish-emo.html b/modern-js/module-tools/en/components/publish-emo.html index 15a836cfb7..819b6489bf 100644 --- a/modern-js/module-tools/en/components/publish-emo.html +++ b/modern-js/module-tools/en/components/publish-emo.html @@ -7,7 +7,7 @@ Modern.js Module - + diff --git a/modern-js/module-tools/en/components/register-esbuild-plugin.html b/modern-js/module-tools/en/components/register-esbuild-plugin.html index 503abde9f2..2a07215756 100644 --- a/modern-js/module-tools/en/components/register-esbuild-plugin.html +++ b/modern-js/module-tools/en/components/register-esbuild-plugin.html @@ -7,7 +7,7 @@ Modern.js Module - +
      modern.config.ts
      import { myEsbuildPlugin } from './myEsbuildPlugin';
      diff --git a/modern-js/module-tools/en/components/release-module-doc.html b/modern-js/module-tools/en/components/release-module-doc.html
      index a10d9bf218..e33aff52a5 100644
      --- a/modern-js/module-tools/en/components/release-module-doc.html
      +++ b/modern-js/module-tools/en/components/release-module-doc.html
      @@ -7,7 +7,7 @@
         
         
         Modern.js Module
      -
      +
       
       
         
      diff --git a/modern-js/module-tools/en/guide/advance/asset.html b/modern-js/module-tools/en/guide/advance/asset.html
      index 46bb92ef8a..3677c7e1f9 100644
      --- a/modern-js/module-tools/en/guide/advance/asset.html
      +++ b/modern-js/module-tools/en/guide/advance/asset.html
      @@ -7,7 +7,7 @@
         
         
         Handle static assets - Modern.js Module
      -
      +
       
       
         

      Handle static assets

      diff --git a/modern-js/module-tools/en/guide/advance/build-umd.html b/modern-js/module-tools/en/guide/advance/build-umd.html index e9788a7566..d0073a15f4 100644 --- a/modern-js/module-tools/en/guide/advance/build-umd.html +++ b/modern-js/module-tools/en/guide/advance/build-umd.html @@ -7,7 +7,7 @@ Build umd artifacts - Modern.js Module - +

      Build umd artifacts

      diff --git a/modern-js/module-tools/en/guide/advance/copy.html b/modern-js/module-tools/en/guide/advance/copy.html index 316fa761ed..0ca26239e5 100644 --- a/modern-js/module-tools/en/guide/advance/copy.html +++ b/modern-js/module-tools/en/guide/advance/copy.html @@ -7,7 +7,7 @@ Use the Copy Tools - Modern.js Module - +

      Use the Copy Tools

      diff --git a/modern-js/module-tools/en/guide/advance/external-dependency.html b/modern-js/module-tools/en/guide/advance/external-dependency.html index ce9033fe40..e90e210149 100644 --- a/modern-js/module-tools/en/guide/advance/external-dependency.html +++ b/modern-js/module-tools/en/guide/advance/external-dependency.html @@ -7,7 +7,7 @@ Handle third-party dependencies - Modern.js Module - +

      Handle third-party dependencies

      diff --git a/modern-js/module-tools/en/guide/advance/in-depth-about-build.html b/modern-js/module-tools/en/guide/advance/in-depth-about-build.html index 7f91d0e4ac..8f3e4f898e 100644 --- a/modern-js/module-tools/en/guide/advance/in-depth-about-build.html +++ b/modern-js/module-tools/en/guide/advance/in-depth-about-build.html @@ -7,7 +7,7 @@ In-depth understanding of build - Modern.js Module - +

      In-depth understanding of build

      diff --git a/modern-js/module-tools/en/guide/advance/in-depth-about-dev-command.html b/modern-js/module-tools/en/guide/advance/in-depth-about-dev-command.html index ec6da7fda3..7c6f1b01d7 100644 --- a/modern-js/module-tools/en/guide/advance/in-depth-about-dev-command.html +++ b/modern-js/module-tools/en/guide/advance/in-depth-about-dev-command.html @@ -7,7 +7,7 @@ In-depth understanding of the dev command - Modern.js Module - +

      In-depth understanding of the dev command

      diff --git a/modern-js/module-tools/en/guide/basic/before-getting-started.html b/modern-js/module-tools/en/guide/basic/before-getting-started.html index d2acba8a2d..c61524f352 100644 --- a/modern-js/module-tools/en/guide/basic/before-getting-started.html +++ b/modern-js/module-tools/en/guide/basic/before-getting-started.html @@ -7,7 +7,7 @@ Before you start - Modern.js Module - +

      Before you start

      diff --git a/modern-js/module-tools/en/guide/basic/command-preview.html b/modern-js/module-tools/en/guide/basic/command-preview.html index 9c992fc9a4..080898ecb3 100644 --- a/modern-js/module-tools/en/guide/basic/command-preview.html +++ b/modern-js/module-tools/en/guide/basic/command-preview.html @@ -7,7 +7,7 @@ CLI Commands - Modern.js Module - +

      CLI Commands

      diff --git a/modern-js/module-tools/en/guide/basic/modify-output-product.html b/modern-js/module-tools/en/guide/basic/modify-output-product.html index 7d39b4ec20..dfd5d4279a 100644 --- a/modern-js/module-tools/en/guide/basic/modify-output-product.html +++ b/modern-js/module-tools/en/guide/basic/modify-output-product.html @@ -7,7 +7,7 @@ Modify the output - Modern.js Module - +

      Modify the output

      diff --git a/modern-js/module-tools/en/guide/basic/publish-your-project.html b/modern-js/module-tools/en/guide/basic/publish-your-project.html index 37de2b4198..23bfa84620 100644 --- a/modern-js/module-tools/en/guide/basic/publish-your-project.html +++ b/modern-js/module-tools/en/guide/basic/publish-your-project.html @@ -7,7 +7,7 @@ Versioning and Publishing - Modern.js Module - +

      Versioning and Publishing

      diff --git a/modern-js/module-tools/en/guide/basic/use-micro-generator.html b/modern-js/module-tools/en/guide/basic/use-micro-generator.html index 9c65e46817..9d51638ff1 100644 --- a/modern-js/module-tools/en/guide/basic/use-micro-generator.html +++ b/modern-js/module-tools/en/guide/basic/use-micro-generator.html @@ -7,7 +7,7 @@ Using the Microgenerator - Modern.js Module - +

      Using the Microgenerator

      diff --git a/modern-js/module-tools/en/guide/basic/use-module-doc.html b/modern-js/module-tools/en/guide/basic/use-module-doc.html index baf75ab57e..8bbc60de1c 100644 --- a/modern-js/module-tools/en/guide/basic/use-module-doc.html +++ b/modern-js/module-tools/en/guide/basic/use-module-doc.html @@ -7,7 +7,7 @@ Developing Module documentation - Modern.js Module - +

      Developing Module documentation

      diff --git a/modern-js/module-tools/en/guide/basic/using-storybook.html b/modern-js/module-tools/en/guide/basic/using-storybook.html index d695f1baed..e8d715e53a 100644 --- a/modern-js/module-tools/en/guide/basic/using-storybook.html +++ b/modern-js/module-tools/en/guide/basic/using-storybook.html @@ -7,7 +7,7 @@ Using Storybook - Modern.js Module - +

      Using Storybook

      diff --git a/modern-js/module-tools/en/guide/best-practices/components.html b/modern-js/module-tools/en/guide/best-practices/components.html index 713e4e9d4f..1608038c7c 100644 --- a/modern-js/module-tools/en/guide/best-practices/components.html +++ b/modern-js/module-tools/en/guide/best-practices/components.html @@ -7,7 +7,7 @@ Developing Components - Modern.js Module - +

      Developing Components

      diff --git a/modern-js/module-tools/en/guide/best-practices/use-tailwindcss.html b/modern-js/module-tools/en/guide/best-practices/use-tailwindcss.html index 0c543d1708..f0902ed66e 100644 --- a/modern-js/module-tools/en/guide/best-practices/use-tailwindcss.html +++ b/modern-js/module-tools/en/guide/best-practices/use-tailwindcss.html @@ -7,7 +7,7 @@ Using Tailwind CSS - Modern.js Module - +

      Using Tailwind CSS

      diff --git a/modern-js/module-tools/en/guide/faq/basic.html b/modern-js/module-tools/en/guide/faq/basic.html index 0eb3ffa2bd..3172465dbe 100644 --- a/modern-js/module-tools/en/guide/faq/basic.html +++ b/modern-js/module-tools/en/guide/faq/basic.html @@ -7,7 +7,7 @@ General Questions - Modern.js Module - +

      General Questions

      diff --git a/modern-js/module-tools/en/guide/faq/build.html b/modern-js/module-tools/en/guide/faq/build.html index d782769724..ac43853fec 100644 --- a/modern-js/module-tools/en/guide/faq/build.html +++ b/modern-js/module-tools/en/guide/faq/build.html @@ -7,7 +7,7 @@ Build FAQ - Modern.js Module - +

      Build FAQ

      diff --git a/modern-js/module-tools/en/guide/faq/index.html b/modern-js/module-tools/en/guide/faq/index.html index 9e4840ce35..f44e4cdb38 100644 --- a/modern-js/module-tools/en/guide/faq/index.html +++ b/modern-js/module-tools/en/guide/faq/index.html @@ -7,7 +7,7 @@ FAQ - Modern.js Module - +

      FAQ

      diff --git a/modern-js/module-tools/en/guide/faq/storybook.html b/modern-js/module-tools/en/guide/faq/storybook.html index d921556230..c9ea2c1992 100644 --- a/modern-js/module-tools/en/guide/faq/storybook.html +++ b/modern-js/module-tools/en/guide/faq/storybook.html @@ -7,7 +7,7 @@ Storybook FAQ - Modern.js Module - +

      Storybook FAQ

      diff --git a/modern-js/module-tools/en/guide/intro/getting-started.html b/modern-js/module-tools/en/guide/intro/getting-started.html index f22cf31958..a8bbc44ea7 100644 --- a/modern-js/module-tools/en/guide/intro/getting-started.html +++ b/modern-js/module-tools/en/guide/intro/getting-started.html @@ -7,7 +7,7 @@ Quick Start - Modern.js Module - +

      Quick Start

      diff --git a/modern-js/module-tools/en/guide/intro/welcome.html b/modern-js/module-tools/en/guide/intro/welcome.html index 6ee3825410..a62cae4556 100644 --- a/modern-js/module-tools/en/guide/intro/welcome.html +++ b/modern-js/module-tools/en/guide/intro/welcome.html @@ -7,7 +7,7 @@ Welcome to Modern.js Module - Modern.js Module - +

      Welcome to Modern.js Module

      diff --git a/modern-js/module-tools/en/guide/intro/why-module-engineering-solution.html b/modern-js/module-tools/en/guide/intro/why-module-engineering-solution.html index 6c0914a1c2..3208a8b665 100644 --- a/modern-js/module-tools/en/guide/intro/why-module-engineering-solution.html +++ b/modern-js/module-tools/en/guide/intro/why-module-engineering-solution.html @@ -7,7 +7,7 @@ Why you need Modern.js Module - Modern.js Module - +

      Why you need Modern.js Module

      diff --git a/modern-js/module-tools/en/index.html b/modern-js/module-tools/en/index.html index a549d018fa..7bf74ca89d 100644 --- a/modern-js/module-tools/en/index.html +++ b/modern-js/module-tools/en/index.html @@ -7,7 +7,7 @@ Modern.js Module - +

      Modern.js Module

      Module engineering solutions

      simple, powerful, high-performance modern npm package development solution

      🚀

      esbuild: The High Performance JS Bundler

      Built on esbuild, the build is extremely fast and gives you the ultimate development experience.

      Two build modes

      Both bundle and bundleless build modes are supported.

      🛠️

      Out of the box

      Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.

      🎨

      Extensible: Provides a powerful plugin mechanism

      With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.

      📦

      Storybook: The community popular UI development tool

      Integrated with Storybook, you can use it to debug UI.

      📐

      Lint: Code Formatting

      Built-in ESLint rules for rich scenarios.

      Copyright © 2023 ByteDance.
      diff --git a/modern-js/module-tools/en/plugins/guide/getting-started.html b/modern-js/module-tools/en/plugins/guide/getting-started.html index d8a5415074..4017609327 100644 --- a/modern-js/module-tools/en/plugins/guide/getting-started.html +++ b/modern-js/module-tools/en/plugins/guide/getting-started.html @@ -7,7 +7,7 @@ Quick Start - Modern.js Module - +

      Quick Start

      diff --git a/modern-js/module-tools/en/plugins/guide/plugin-object.html b/modern-js/module-tools/en/plugins/guide/plugin-object.html index 81b79e2234..fc853f83ca 100644 --- a/modern-js/module-tools/en/plugins/guide/plugin-object.html +++ b/modern-js/module-tools/en/plugins/guide/plugin-object.html @@ -7,7 +7,7 @@ Plugin Object - Modern.js Module - +

      Plugin Object

      diff --git a/modern-js/module-tools/en/plugins/guide/setup-function.html b/modern-js/module-tools/en/plugins/guide/setup-function.html index e1e85f983f..57ba8c060e 100644 --- a/modern-js/module-tools/en/plugins/guide/setup-function.html +++ b/modern-js/module-tools/en/plugins/guide/setup-function.html @@ -7,7 +7,7 @@ Setup function - Modern.js Module - +

      Setup function

      diff --git a/modern-js/module-tools/en/plugins/official-list/overview.html b/modern-js/module-tools/en/plugins/official-list/overview.html index d23f78a62c..06258f3fb4 100644 --- a/modern-js/module-tools/en/plugins/official-list/overview.html +++ b/modern-js/module-tools/en/plugins/official-list/overview.html @@ -7,7 +7,7 @@ Overview - Modern.js Module - +

      Overview

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-babel.html b/modern-js/module-tools/en/plugins/official-list/plugin-babel.html index be5cd71fae..7d02b4a7f2 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-babel.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-babel.html @@ -7,7 +7,7 @@ Babel Plugin - Modern.js Module - +

      Babel Plugin

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-banner.html b/modern-js/module-tools/en/plugins/official-list/plugin-banner.html index a4d708051a..6395a6b862 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-banner.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-banner.html @@ -7,7 +7,7 @@ Banner Plugin - Modern.js Module - +

      Banner Plugin

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-import.html b/modern-js/module-tools/en/plugins/official-list/plugin-import.html index 12288f7341..24517a7be9 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-import.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-import.html @@ -7,7 +7,7 @@ Import Plugin - Modern.js Module - +

      Import Plugin

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-node-polyfill.html b/modern-js/module-tools/en/plugins/official-list/plugin-node-polyfill.html index 3025be3960..5c29d51535 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-node-polyfill.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-node-polyfill.html @@ -7,7 +7,7 @@ Node Polyfill Plugin - Modern.js Module - +

      Node Polyfill Plugin

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-polyfill.html b/modern-js/module-tools/en/plugins/official-list/plugin-polyfill.html index 3c5f543a60..80b912dfae 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-polyfill.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-polyfill.html @@ -7,7 +7,7 @@ Polyfill Plugin - Modern.js Module - +

      Polyfill Plugin

      diff --git a/modern-js/module-tools/en/plugins/official-list/plugin-vue.html b/modern-js/module-tools/en/plugins/official-list/plugin-vue.html index 6729b3bae0..ce25a18096 100644 --- a/modern-js/module-tools/en/plugins/official-list/plugin-vue.html +++ b/modern-js/module-tools/en/plugins/official-list/plugin-vue.html @@ -7,7 +7,7 @@ Vue Plugin - Modern.js Module - +

      Vue Plugin

      diff --git a/modern-js/module-tools/guide/advance/asset.html b/modern-js/module-tools/guide/advance/asset.html index c83394f3bc..053b23e518 100644 --- a/modern-js/module-tools/guide/advance/asset.html +++ b/modern-js/module-tools/guide/advance/asset.html @@ -7,7 +7,7 @@ 处理静态资源 - Modern.js Module - +

      处理静态资源

      diff --git a/modern-js/module-tools/guide/advance/build-umd.html b/modern-js/module-tools/guide/advance/build-umd.html index 4ff80ef800..d950451201 100644 --- a/modern-js/module-tools/guide/advance/build-umd.html +++ b/modern-js/module-tools/guide/advance/build-umd.html @@ -7,7 +7,7 @@ 构建 umd 产物 - Modern.js Module - +

      构建 umd 产物

      diff --git a/modern-js/module-tools/guide/advance/copy.html b/modern-js/module-tools/guide/advance/copy.html index 25b9061392..b47da07904 100644 --- a/modern-js/module-tools/guide/advance/copy.html +++ b/modern-js/module-tools/guide/advance/copy.html @@ -7,7 +7,7 @@ 使用 Copy 工具 - Modern.js Module - +

      使用 Copy 工具

      diff --git a/modern-js/module-tools/guide/advance/external-dependency.html b/modern-js/module-tools/guide/advance/external-dependency.html index a7616dae85..1c330a589e 100644 --- a/modern-js/module-tools/guide/advance/external-dependency.html +++ b/modern-js/module-tools/guide/advance/external-dependency.html @@ -7,7 +7,7 @@ 处理三方依赖 - Modern.js Module - +

      处理三方依赖

      diff --git a/modern-js/module-tools/guide/advance/in-depth-about-build.html b/modern-js/module-tools/guide/advance/in-depth-about-build.html index 58d9ccb239..1e29cd06a5 100644 --- a/modern-js/module-tools/guide/advance/in-depth-about-build.html +++ b/modern-js/module-tools/guide/advance/in-depth-about-build.html @@ -7,7 +7,7 @@ 深入理解构建 - Modern.js Module - +

      深入理解构建

      diff --git a/modern-js/module-tools/guide/advance/in-depth-about-dev-command.html b/modern-js/module-tools/guide/advance/in-depth-about-dev-command.html index 545dcfb7ce..a66881f5ce 100644 --- a/modern-js/module-tools/guide/advance/in-depth-about-dev-command.html +++ b/modern-js/module-tools/guide/advance/in-depth-about-dev-command.html @@ -7,7 +7,7 @@ 深入理解 dev 命令 - Modern.js Module - +

      深入理解 dev 命令

      diff --git a/modern-js/module-tools/guide/basic/before-getting-started.html b/modern-js/module-tools/guide/basic/before-getting-started.html index d9d5191419..b36c9eb175 100644 --- a/modern-js/module-tools/guide/basic/before-getting-started.html +++ b/modern-js/module-tools/guide/basic/before-getting-started.html @@ -7,7 +7,7 @@ 开始之前 - Modern.js Module - +

      开始之前

      diff --git a/modern-js/module-tools/guide/basic/command-preview.html b/modern-js/module-tools/guide/basic/command-preview.html index 20e9f507a4..bdaa962ca7 100644 --- a/modern-js/module-tools/guide/basic/command-preview.html +++ b/modern-js/module-tools/guide/basic/command-preview.html @@ -7,7 +7,7 @@ CLI 命令 - Modern.js Module - +

      CLI 命令

      diff --git a/modern-js/module-tools/guide/basic/modify-output-product.html b/modern-js/module-tools/guide/basic/modify-output-product.html index 7fb77033e2..4d5300c330 100644 --- a/modern-js/module-tools/guide/basic/modify-output-product.html +++ b/modern-js/module-tools/guide/basic/modify-output-product.html @@ -7,7 +7,7 @@ 修改输出产物 - Modern.js Module - +

      修改输出产物

      diff --git a/modern-js/module-tools/guide/basic/publish-your-project.html b/modern-js/module-tools/guide/basic/publish-your-project.html index 14fed9f046..2b1a67dfe4 100644 --- a/modern-js/module-tools/guide/basic/publish-your-project.html +++ b/modern-js/module-tools/guide/basic/publish-your-project.html @@ -7,7 +7,7 @@ 版本管理与发布 - Modern.js Module - +

      版本管理与发布

      diff --git a/modern-js/module-tools/guide/basic/use-micro-generator.html b/modern-js/module-tools/guide/basic/use-micro-generator.html index dceffee55a..ffedbedd1c 100644 --- a/modern-js/module-tools/guide/basic/use-micro-generator.html +++ b/modern-js/module-tools/guide/basic/use-micro-generator.html @@ -7,7 +7,7 @@ 使用微生成器 - Modern.js Module - +

      使用微生成器

      diff --git a/modern-js/module-tools/guide/basic/use-module-doc.html b/modern-js/module-tools/guide/basic/use-module-doc.html index 303c42f71f..886551228d 100644 --- a/modern-js/module-tools/guide/basic/use-module-doc.html +++ b/modern-js/module-tools/guide/basic/use-module-doc.html @@ -7,7 +7,7 @@ 开发模块文档 - Modern.js Module - +

      开发模块文档

      diff --git a/modern-js/module-tools/guide/basic/using-storybook.html b/modern-js/module-tools/guide/basic/using-storybook.html index 382df5636b..7f380eb423 100644 --- a/modern-js/module-tools/guide/basic/using-storybook.html +++ b/modern-js/module-tools/guide/basic/using-storybook.html @@ -7,7 +7,7 @@ 使用 Storybook - Modern.js Module - +

      使用 Storybook

      diff --git a/modern-js/module-tools/guide/best-practices/components.html b/modern-js/module-tools/guide/best-practices/components.html index 5bdbf0acac..10d3739c99 100644 --- a/modern-js/module-tools/guide/best-practices/components.html +++ b/modern-js/module-tools/guide/best-practices/components.html @@ -7,7 +7,7 @@ 开发组件 - Modern.js Module - +

      开发组件

      diff --git a/modern-js/module-tools/guide/best-practices/use-tailwindcss.html b/modern-js/module-tools/guide/best-practices/use-tailwindcss.html index 46001b1785..5af1570493 100644 --- a/modern-js/module-tools/guide/best-practices/use-tailwindcss.html +++ b/modern-js/module-tools/guide/best-practices/use-tailwindcss.html @@ -7,7 +7,7 @@ 使用 Tailwind CSS - Modern.js Module - +

      使用 Tailwind CSS

      diff --git a/modern-js/module-tools/guide/faq/basic.html b/modern-js/module-tools/guide/faq/basic.html index 97a683d7f5..e51952cb75 100644 --- a/modern-js/module-tools/guide/faq/basic.html +++ b/modern-js/module-tools/guide/faq/basic.html @@ -7,7 +7,7 @@ 通用类问题 - Modern.js Module - +

      通用类问题

      diff --git a/modern-js/module-tools/guide/faq/build.html b/modern-js/module-tools/guide/faq/build.html index b8b2a414fd..830e99db78 100644 --- a/modern-js/module-tools/guide/faq/build.html +++ b/modern-js/module-tools/guide/faq/build.html @@ -7,7 +7,7 @@ 构建相关问题 - Modern.js Module - +

      构建相关问题

      diff --git a/modern-js/module-tools/guide/faq/index.html b/modern-js/module-tools/guide/faq/index.html index aecad6fa34..9bf25ae3b5 100644 --- a/modern-js/module-tools/guide/faq/index.html +++ b/modern-js/module-tools/guide/faq/index.html @@ -7,7 +7,7 @@ 常见问题 - Modern.js Module - +

      常见问题

      diff --git a/modern-js/module-tools/guide/faq/storybook.html b/modern-js/module-tools/guide/faq/storybook.html index db4780a7ba..86f2c2eaad 100644 --- a/modern-js/module-tools/guide/faq/storybook.html +++ b/modern-js/module-tools/guide/faq/storybook.html @@ -7,7 +7,7 @@ Storybook 相关问题 - Modern.js Module - +

      Storybook 相关问题

      diff --git a/modern-js/module-tools/guide/intro/getting-started.html b/modern-js/module-tools/guide/intro/getting-started.html index d7b340eb90..de2416c1fb 100644 --- a/modern-js/module-tools/guide/intro/getting-started.html +++ b/modern-js/module-tools/guide/intro/getting-started.html @@ -7,7 +7,7 @@ 快速开始 - Modern.js Module - +

      快速开始

      diff --git a/modern-js/module-tools/guide/intro/welcome.html b/modern-js/module-tools/guide/intro/welcome.html index 3034d5a556..1449a92fc3 100644 --- a/modern-js/module-tools/guide/intro/welcome.html +++ b/modern-js/module-tools/guide/intro/welcome.html @@ -7,7 +7,7 @@ 欢迎使用 - Modern.js Module - +

      欢迎使用

      diff --git a/modern-js/module-tools/guide/intro/why-module-engineering-solution.html b/modern-js/module-tools/guide/intro/why-module-engineering-solution.html index 7bb1cf4d9a..a264913fa3 100644 --- a/modern-js/module-tools/guide/intro/why-module-engineering-solution.html +++ b/modern-js/module-tools/guide/intro/why-module-engineering-solution.html @@ -7,7 +7,7 @@ 为什么需要 Modern.js Module - Modern.js Module - +

      为什么需要 Modern.js Module

      diff --git a/modern-js/module-tools/index.html b/modern-js/module-tools/index.html index aef284d722..5dc7bfc1ee 100644 --- a/modern-js/module-tools/index.html +++ b/modern-js/module-tools/index.html @@ -7,7 +7,7 @@ Modern.js Module - +

      Modern.js Module

      模块工程解决方案

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

      🚀

      esbuild: 高性能的 JS Bundler

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

      双构建模式

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

      🛠️

      开箱即用

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

      🎨

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

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

      📦

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

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

      📐

      Lint: 代码格式化

      丰富场景的内置 ESLint 规则。

      Copyright © 2023 ByteDance.
      diff --git a/modern-js/module-tools/plugins/guide/getting-started.html b/modern-js/module-tools/plugins/guide/getting-started.html index d0ef999256..e8826fd571 100644 --- a/modern-js/module-tools/plugins/guide/getting-started.html +++ b/modern-js/module-tools/plugins/guide/getting-started.html @@ -7,7 +7,7 @@ 快速开始 - Modern.js Module - +

      快速开始

      diff --git a/modern-js/module-tools/plugins/guide/plugin-object.html b/modern-js/module-tools/plugins/guide/plugin-object.html index cfa82d5610..5d981b099b 100644 --- a/modern-js/module-tools/plugins/guide/plugin-object.html +++ b/modern-js/module-tools/plugins/guide/plugin-object.html @@ -7,7 +7,7 @@ 插件对象 - Modern.js Module - +

      插件对象

      diff --git a/modern-js/module-tools/plugins/guide/setup-function.html b/modern-js/module-tools/plugins/guide/setup-function.html index 6765cf98bd..f4f7c964e8 100644 --- a/modern-js/module-tools/plugins/guide/setup-function.html +++ b/modern-js/module-tools/plugins/guide/setup-function.html @@ -7,7 +7,7 @@ Setup 函数 - Modern.js Module - +

      Setup 函数

      diff --git a/modern-js/module-tools/plugins/official-list/overview.html b/modern-js/module-tools/plugins/official-list/overview.html index 2ab136ad78..39240f4ff5 100644 --- a/modern-js/module-tools/plugins/official-list/overview.html +++ b/modern-js/module-tools/plugins/official-list/overview.html @@ -7,7 +7,7 @@ 总览 - Modern.js Module - +

      总览

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-babel.html b/modern-js/module-tools/plugins/official-list/plugin-babel.html index 419a4452cd..79bc4d0171 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-babel.html +++ b/modern-js/module-tools/plugins/official-list/plugin-babel.html @@ -7,7 +7,7 @@ Babel 插件 - Modern.js Module - +

      Babel 插件

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-banner.html b/modern-js/module-tools/plugins/official-list/plugin-banner.html index ab54a607f6..72ce3a89df 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-banner.html +++ b/modern-js/module-tools/plugins/official-list/plugin-banner.html @@ -7,7 +7,7 @@ Banner 插件 - Modern.js Module - +

      Banner 插件

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-import.html b/modern-js/module-tools/plugins/official-list/plugin-import.html index dc1ccc9a13..8466ebee36 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-import.html +++ b/modern-js/module-tools/plugins/official-list/plugin-import.html @@ -7,7 +7,7 @@ Import 插件 - Modern.js Module - +

      Import 插件

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html b/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html index 959a62c526..33e40d9649 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html +++ b/modern-js/module-tools/plugins/official-list/plugin-node-polyfill.html @@ -7,7 +7,7 @@ Node Polyfill 插件 - Modern.js Module - +

      Node Polyfill 插件

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-polyfill.html b/modern-js/module-tools/plugins/official-list/plugin-polyfill.html index 355e104418..486c4333d2 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-polyfill.html +++ b/modern-js/module-tools/plugins/official-list/plugin-polyfill.html @@ -7,7 +7,7 @@ Polyfill 插件 - Modern.js Module - +

      Polyfill 插件

      diff --git a/modern-js/module-tools/plugins/official-list/plugin-vue.html b/modern-js/module-tools/plugins/official-list/plugin-vue.html index 5a02b36684..2a27ba4fcf 100644 --- a/modern-js/module-tools/plugins/official-list/plugin-vue.html +++ b/modern-js/module-tools/plugins/official-list/plugin-vue.html @@ -7,7 +7,7 @@ Vue 插件 - Modern.js Module - +

      Vue 插件

      diff --git a/modern-js/module-tools/static/js/2970.23f1b858.js b/modern-js/module-tools/static/js/2970.43a165d0.js similarity index 51% rename from modern-js/module-tools/static/js/2970.23f1b858.js rename to modern-js/module-tools/static/js/2970.43a165d0.js index 0f2bf23a27..26e0c5a17f 100644 --- a/modern-js/module-tools/static/js/2970.23f1b858.js +++ b/modern-js/module-tools/static/js/2970.43a165d0.js @@ -1,2 +1,2 @@ -/*! For license information please see 2970.23f1b858.js.LICENSE.txt */ -(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2970"],{835:function(e,t,n){"use strict";n.d(t,{Jr:function(){return s},Ni:function(){return o},R0:function(){return a},Vi:function(){return l},aw:function(){return d},n_:function(){return c}});var i=n(2363),r=n(1850);let a=(0,i.createContext)({}),o=(0,i.createContext)({});function l(){return(0,i.useContext)(a).data}function s(){return(0,i.useContext)(a).data.page.lang||""}function d(){return(0,i.useContext)(a).data.page.version||""}function c(e){let[t,n]=(0,i.useState)(e);return(0,i.useLayoutEffect)(()=>{document.startViewTransition&&t!==e?document.startViewTransition(()=>{(0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent"))}):((0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent")))},[e]),t}},7833:function(e,t,n){"use strict";n.d(t,{AP:function(){return d},E9:function(){return l},Tm:function(){return a},i6:function(){return c},pJ:function(){return o},pV:function(){return s}});var i=n(6780),r=n(33);function a(e){return decodeURIComponent(e).replace(/\.html$/,"").replace(/\/index$/,"/")}function o(e="/"){return(0,r.pJ)(e,i.Z.base)}function l(e){return(0,r.E9)(e,i.Z.base)}function s(e,t){return o(d((0,r.lm)(e)))===o(d((0,r.lm)(t)))}function d(e){let t=!!i.Z?.route?.cleanUrls;return(0,r.yc)(e,t)}function c(e){return!(0,r.yv)()||(0,r.xf)(e)||(0,r.pZ)(e)||e.startsWith("//")||!e.startsWith("/")?e:o(e)}},429:function(e,t){"use strict";t.parse=function(e){for(var t,n=[],i=String(e||""),r=i.indexOf(","),a=0,o=!1;!o;)-1===r&&(r=i.length,o=!0),((t=i.slice(a,r).trim())||!o)&&n.push(t),a=r+1,r=i.indexOf(",",a);return n};function n(e,t){var n=t||{},i=!1===n.padLeft?"":" ",r=n.padRight?" ":"";return""===e[e.length-1]&&(e=e.concat("")),e.join(r+","+i).trim()}},9522:function(e,t,n){"use strict";var i=n(8456),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,a,o,l,s,d,c,u,h=!1;!t&&(t={}),o=t.debug||!1;try{if(s=i(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(n){if(n.stopPropagation(),t.format){if(n.preventDefault(),void 0===n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e)}t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");h=!0}catch(i){o&&console.error("unable to copy using execCommand: ",i),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(i){;o&&console.error("unable to copy using clipboardData: ",i),o&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",a=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C",l=n.replace(/#{\s*key\s*}/g,a),window.prompt(l,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}},5653:function(e){"use strict";var t,n;let i;t=function e(t){let n;function i(e,t){let n=t?t.id:e&&e.id;this.id=n||0===n?n:_++,this.init(e,t),l(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)}),l(this,"length",function(){return this.index.length})}function r(e,t,n,i){return this.u!==this.g&&(this.o=this.o.concat(n),this.u++,i&&this.o.length>=i&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(t,this.o),this.F&&this.F(this.o))),this}function a(e,t){let n=e.length,i=y(t),r=[];for(let a=0,o=0;a=o&&((e=(e=e[l-(r+.5>>0)])[n]||(e[n]=[]))[e.length]=i),r)}function u(e,t){if(e){let n=Object.keys(e);for(let i=0,r=n.length;i(e=e.length-t.length)?1:e?-1:0}function m(e,t){return e=e[n],e<(t=t[n])?-1:e>t?1:0}function f(e,t){let i=n.length;for(let r=0;rt?1:0}function g(e,t,n){return e?{page:e,next:t?""+t:null,result:n}:n}function x(e,t,n,i,r,a,o){let l,s=[];if(!0===n){n="0";var d=""}else d=n&&n.split(":");let c=e.length;if(1o&&(d=0),(l=(d=d||0)+t)=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:e,content:t}),this.c[o]=""+this.C,n&&n(),this;if(!r){if(this.async&&"function"!=typeof importScripts){let r=this;return(o=new Promise(function(n){setTimeout(function(){r.add(e,t,null,i,!0),r=null,n()})}),n)?(o.then(n),this):o}if(n)return this.add(e,t,null,i,!0),n(),this}if(!(t=this.encode(t)).length)return this;r=y(n=this.f)?n(t):t.split(this.split),this.filter&&(r=a(r,this.filter));let p=I();p._ctx=I();let m=r.length,f=this.threshold,g=this.depth,x=this.b,v=this.i,b=this.D;for(let t=0;th;n--)c(v,p,u=l.substring(h,n),e,t,d,f,x-1)}break;default:if(s=c(v,p,l,e,1,d,f,x-1),g&&1=f)for(s=p._ctx[l]||(p._ctx[l]=I()),l=this.h[l]||(this.h[l]=j(x-(f||0))),0>(d=t-g)&&(d=0),(u=t+g+1)>m&&(u=m);dr;n--)i=a[n-1],a[n]=i,t[i]=n;a[r]=e,t[e]=r}}}return t},e}();return i}(function(){let e={},t="undefined"!=typeof Blob&&"undefined"!=typeof URL&&URL.createObjectURL;return function(n,i,r,a,o){return r=t?URL.createObjectURL(new Blob(["("+r.toString()+")()"],{type:"text/javascript"})):n+".min.js",e[n+="-"+i]||(e[n]=[]),e[n][o]=new Worker(r),e[n][o].onmessage=a,e[n][o]}}()),n=this,(i=n.define)&&i.amd?i([],function(){return t}):(i=n.modules)?i["FlexSearch".toLowerCase()]=t:e.exports=t},3451:function(e){"use strict";e.exports=function(e,n){for(var i,r,a,o=e||"",l=n||"div",s={},d=0;d-1}var o=["itemScope"];function l(t,n,i,r){void 0===r&&(r=null);var a=i[t],o=i._;return a?e.createElement(a,n,r):o?o(t,n,r):e.createElement(t,n,r)}return function(e,i){if(void 0===i&&(i={}),"string"!=typeof e)throw TypeError("Expected HTML string");var a=document.createElement("div");a.innerHTML=e.trim();var o=Array.from(a.childNodes).map(function(e,a){return function e(i,a,o){var s,d,c,u,h=o.transform||{},p=o.preserveAttributes||[],m=o.dangerouslySetChildren||["style"],f=h._;if(8===i.nodeType)return null;if(3===i.nodeType){var g=i.textContent;return f?f(g):g}for(var x={},v=i.attributes,b=0;b1){var r,o=(r=i[0].trim(),/^-ms-/.test(r)&&(r=r.substr(1)),r.startsWith("--")?r:t(r)),l=(n=i.slice(1).join(":").trim(),/^\d+$/.test(n)?Number(n):n.replace(/'/g,'"'));a[o]=l}}),a);else{var l=d[n],h=""===l||String(l).toLowerCase()===i.toLowerCase();e[o.name]=o.isBoolean?h:l}return e},{})),k=Array.from(i.childNodes).map(function(t,i){return n.indexOf(y)>-1&&3===t.nodeType&&(t.textContent=t.textContent.trim(),""===t.textContent)?null:e(t,a+"."+i,o)}).filter(Boolean);if(m.indexOf(y)>-1){var j=i.innerHTML;return j&&("style"!==y&&"script"!==y&&(j=j.replace(/"/g,""")),w.dangerouslySetInnerHTML={__html:j.trim()}),l(y,w,h)}return l(y,w,h,0===k.length?null:k)}(e,String(a),i)}).filter(Boolean);return 1===o.length?o[0]:o}},e.exports=r(n(2363))},4546:function(e){"use strict";e.exports=function(e,t,n,i,r,a,o,l){if(!e){var s;if(void 0===t)s=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,i,r,a,o,l],c=0;(s=Error(t.replace(/%s/g,function(){return d[c++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}}},4761:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},9975:function(e,t,n){"use strict";var i=n(4761),r=n(7525);e.exports=function(e){return i(e)||r(e)}},7525:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},2201:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},7841:function(e){var t,n;t=0,n=function(){var e,t,n,i={};i.version="0.2.0";var r=i.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
      '};function a(e,t,n){return en?n:e}function o(e){return(-1+e)*100}i.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},i.status=null,i.set=function(e){var t=i.isStarted();e=a(e,r.minimum,1),i.status=1===e?null:e;var n=i.render(!t),o=n.querySelector(r.barSelector),d=r.speed,c=r.easing;return n.offsetWidth,l(function(t){""===r.positionUsing&&(r.positionUsing=i.getPositioningCSS()),s(o,function(e,t,n){var i;if("translate3d"===r.positionUsing)i={transform:"translate3d("+(-1+e)*100+"%,0,0)"};else if("translate"===r.positionUsing)i={transform:"translate("+(-1+e)*100+"%,0)"};else i={"margin-left":(-1+e)*100+"%"};return i.transition="all "+t+"ms "+n,i}(e,d,c)),1===e?(s(n,{transition:"none",opacity:1}),n.offsetWidth,setTimeout(function(){s(n,{transition:"all "+d+"ms linear",opacity:0}),setTimeout(function(){i.remove(),t()},d)},d)):setTimeout(t,d)}),this},i.isStarted=function(){return"number"==typeof i.status},i.start=function(){!i.status&&i.set(0);var e=function(){setTimeout(function(){i.status&&(i.trickle(),e())},r.trickleSpeed)};return r.trickle&&e(),this},i.done=function(e){return e||i.status?i.inc(.3+.5*Math.random()).set(1):this},i.inc=function(e){var t=i.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),i.set(t)):i.start()},i.trickle=function(){return i.inc(Math.random()*r.trickleRate)},e=0,t=0,i.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&i.start(),e++,t++,n.always(function(){0==--t?(e=0,i.done()):i.set((e-t)/e)}),this):this},i.render=function(e){if(i.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var n,a=t.querySelector(r.barSelector),o=e?"-100":function(e){return(-1+e)*100}(i.status||0),l=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+o+"%,0,0)"}),!r.showSpinner&&(n=t.querySelector(r.spinnerSelector))&&p(n),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},i.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},i.isRendered=function(){return!!document.getElementById("nprogress")},i.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective" in e?"translate3d":t+"Transform" in e?"translate":"margin"};var l=(n=[],function(e){n.push(e),1==n.length&&!function e(){var t=n.shift();t&&t(e)}()}),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n,i,r){i=function(n){return t[n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var i,r=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((i=e[r]+a)in n)return i;return t}(n))}(i),n.style[i]=r}return function(e,t){var i,r,a=arguments;if(2==a.length)for(i in t)void 0!==(r=t[i])&&t.hasOwnProperty(i)&&n(e,i,r);else n(e,a[1],a[2])}}();function d(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=h(e),i=n+t;!d(n,t)&&(e.className=i.substring(1))}function u(e,t){var n,i=h(e);d(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return i},"function"==typeof define&&define.amd?define(n):e.exports=n()},5144:function(e){"use strict";var t;e.exports=function(e){var n,i="&"+e+";";return(t=t||document.createElement("i")).innerHTML=i,(59!==(n=t.textContent).charCodeAt(n.length-1)||"semi"===e)&&n!==i&&n}},2668:function(e,t,n){"use strict";var i=n(924),r=n(3222),a=n(7525),o=n(2201),l=n(9975),s=n(5144);e.exports=function(e,t){var n,a,o={};for(a in!t&&(t={}),h)n=t[a],o[a]=null==n?h[a]:n;return(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start),function(e,t){var n,a,o,h,b,y,w,k,j,I,P,S,E,C,_,N,z,A,T,O=t.additional,M=t.nonTerminated,L=t.text,R=t.reference,$=t.warning,B=t.textContext,D=t.referenceContext,H=t.warningContext,F=t.position,W=t.indent||[],q=e.length,U=0,V=-1,G=F.column||1,Z=F.line||1,Y="",K=[];for("string"==typeof O&&(O=O.charCodeAt(0)),N=J(),k=$?function(e,t){var n=J();n.column+=t,n.offset+=t,$.call(H,v[e],n,e)}:u,U--,q++;++U=55296&&e<=57343||e>1114111}(y=parseInt(h,g[C]))?(k(7,A),y=c(65533)):y in r?(k(6,A),y=r[y]):(I="",function(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(65535&e)==65535||(65535&e)==65534}(y)&&k(6,A),y>65535&&(y-=65536,I+=c(y>>>10|55296),y=56320|1023&y),y=I+c(y))):C!==p&&k(4,A);y?(Q(),N=J(),U=T-1,G+=T-E+1,K.push(y),z=J(),z.offset++,R&&R.call(D,y,{start:N,end:z},e.slice(E-1,T)),N=z):(h=e.slice(E-1,T),Y+=h,G+=h.length,U=T-1)}else 10===b&&(Z++,V++,G=0),b==b?(Y+=c(b),G++):Q();return K.join("");function J(){return{line:Z,column:G,offset:U+(F.offset||0)}}function Q(){Y&&(K.push(Y),L&&L.call(B,Y,{start:N,end:J()}),Y="")}}(e,o)};var d={}.hasOwnProperty,c=String.fromCharCode,u=Function.prototype,h={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",f="decimal",g={};g[m]=16,g[f]=10;var x={};x[p]=l,x[f]=a,x[m]=o;var v={};v[1]="Named character references must be terminated by a semicolon",v[2]="Numeric character references must be terminated by a semicolon",v[3]="Named character references cannot be empty",v[4]="Numeric character references cannot be empty",v[5]="Named character references must be known",v[6]="Numeric character references cannot be disallowed",v[7]="Numeric character references cannot be outside the permissible Unicode range"},3921:function(e,t,n){var i=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach));k+=w.value.length,w=w.next){;var j,I=w.value;if(n.length>t.length)return;if(!(I instanceof a)){var P=1;if(x){if(!(j=o(y,k,t,g))||j.index>=t.length)break;var S=j.index,E=j.index+j[0].length,C=k;for(C+=w.value.length;S>=C;)C+=(w=w.next).value.length;if(C-=w.value.length,k=C,w.value instanceof a)continue;for(var _=w;_!==n.tail&&(Cc.reach&&(c.reach=T);var O=w.prev;if(z&&(O=s(n,O,z),k+=z.length),function(e,t,n){for(var i=t.next,r=0;r1){var M={cause:u+","+p,reach:T};e(t,n,i,w.prev,k,M),c&&M.reach>c.reach&&(c.reach=M.reach)}}}}}}}(e,d,t,d.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(d)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!!n&&!!n.length)for(var i,a=0;i=n[a++];)i(t)}},Token:a};function a(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function o(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var a=r[1].length;r.index+=a,r[0]=r[0].slice(a)}return r}e.Prism=r,a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run("wrap",a);var l="";for(var s in a.attributes)l+=" "+s+'="'+(a.attributes[s]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+""};function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}if(!e.document)return e.addEventListener?(!r.disableWorkerMessageHandler&&e.addEventListener("message",function(t){var n=JSON.parse(t.data),i=n.language,a=n.code,o=n.immediateClose;e.postMessage(r.highlight(a,r.languages[i],i)),o&&e.close()},!1),r):r;var d=r.util.currentScript();function c(){!r.manual&&r.highlightAll()}if(d&&(r.filename=d.src,d.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var u=document.readyState;"loading"===u||"interactive"===u&&d&&d.defer?document.addEventListener("DOMContentLoaded",c):window.requestAnimationFrame?window.requestAnimationFrame(c):window.setTimeout(c,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=i),void 0!==n.g&&(n.g.Prism=i)},2504:function(e,t,n){"use strict";var i=n(2265);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,a,o){if(o!==i){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return n.PropTypes=n,n}},3698:function(e,t,n){e.exports=n(2504)()},2265:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2616:function(e,t,n){"use strict";var i=n(2275),r=n(6492),a=n(3811),o="data";e.exports=function(e,t){var n=i(t),h=t,p=a;return n in e.normal?e.property[e.normal[n]]:(n.length>4&&n.slice(0,4)===o&&l.test(t)&&("-"===t.charAt(4)?h=function(e){var t=e.slice(5).replace(s,u);return o+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);return s.test(t)?e:("-"!==(t=t.replace(d,c)).charAt(0)&&(t="-"+t),o+t)}(t),p=r),new p(h,t))};var l=/^data[-\w.:]+$/i,s=/-[a-z]/g,d=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function u(e){return e.charAt(1).toUpperCase()}},6093:function(e,t,n){"use strict";var i=n(6399),r=n(9283),a=n(7430),o=n(2376),l=n(5531),s=n(1581);e.exports=i([a,r,o,l,s])},5531:function(e,t,n){"use strict";var i=n(3077),r=n(9469),a=i.booleanish,o=i.number,l=i.spaceSeparated;e.exports=r({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:a,ariaAutoComplete:null,ariaBusy:a,ariaChecked:a,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:a,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:a,ariaFlowTo:l,ariaGrabbed:a,ariaHasPopup:null,ariaHidden:a,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:o,ariaLive:null,ariaModal:a,ariaMultiLine:a,ariaMultiSelectable:a,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:a,ariaReadOnly:a,ariaRelevant:null,ariaRequired:a,ariaRoleDescription:l,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:a,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},1581:function(e,t,n){"use strict";var i=n(3077),r=n(9469),a=n(2561),o=i.boolean,l=i.overloadedBoolean,s=i.booleanish,d=i.number,c=i.spaceSeparated,u=i.commaSeparated;e.exports=r({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:a,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:u,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:c,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:c,cols:d,colSpan:null,content:null,contentEditable:s,controls:o,controlsList:c,coords:d|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:l,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:c,height:d,hidden:o,high:d,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:u,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:c,itemRef:c,itemScope:o,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:o,low:d,manifest:null,max:null,maxLength:d,media:null,method:null,min:null,minLength:d,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:o,optimum:d,pattern:null,ping:c,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:c,required:o,reversed:o,rows:d,rowSpan:d,sandbox:c,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:d,sizes:null,slot:null,span:d,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:u,start:d,step:null,style:null,tabIndex:d,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:s,width:d,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:d,borderColor:null,bottomMargin:d,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:d,leftMargin:d,link:null,longDesc:null,lowSrc:null,marginHeight:d,marginWidth:d,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:d,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:d,valueType:null,version:null,vAlign:null,vLink:null,vSpace:d,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:o,disableRemotePlayback:o,prefix:null,property:null,results:d,security:null,unselectable:null}})},2561:function(e,t,n){"use strict";var i=n(6073);e.exports=function(e,t){return i(e,t.toLowerCase())}},6073:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},9469:function(e,t,n){"use strict";var i=n(2275),r=n(3673),a=n(6492);e.exports=function(e){var t,n,o=e.space,l=e.mustUseProperty||[],s=e.attributes||{},d=e.properties,c=e.transform,u={},h={};for(t in d)n=new a(t,c(s,t),d[t],o),-1!==l.indexOf(t)&&(n.mustUseProperty=!0),u[t]=n,h[i(t)]=t,h[i(n.attribute)]=t;return new r(u,h,o)}},6492:function(e,t,n){"use strict";var i=n(3811),r=n(3077);e.exports=l,l.prototype=new i,l.prototype.defined=!0;var a=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],o=a.length;function l(e,t,n,l){var s,d=-1;for(function(e,t,n){n&&(e[t]=n)}(this,"space",l),i.call(this,e,t);++d=0||(r[n]=e[n]);return r}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},x={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},b={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},y=Object.keys(g).map(function(e){return g[e]}),w={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(w).reduce(function(e,t){return e[w[t]]=t,e},{}),j=function(e,t){for(var n=e.length-1;n>=0;n-=1){var i=e[n];if(Object.prototype.hasOwnProperty.call(i,t))return i[t]}return null},I=function(e){var t=j(e,g.TITLE),n=j(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,function(){return t});var i=j(e,"defaultTitle");return t||i||void 0},P=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return h({},e,t)},{})},S=function(e,t,n){var i={};return n.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,n){var r={};n.filter(function(e){for(var n,a=Object.keys(e),o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")},T=function(e){return Object.keys(e).reduce(function(t,n){var i=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+i:i},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,n){return t[w[n]||n]=e[n],t},t)},M=function(e,t){return t.map(function(t,n){var r,a=((r={key:n})["data-rh"]=!0,r);return Object.keys(t).forEach(function(e){var n=w[e]||e;"innerHTML"===n||"cssText"===n?a.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:a[n]=t[e]}),i.createElement(e,a)})},L=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){var e,n,r,a;return n=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,a=O(n,r),[i.createElement(g.TITLE,a,e)]},toString:function(){var i,r,a,o,l,s;return i=e,r=t.title,a=t.titleAttributes,o=n,l=T(a),s=C(r),l?"<"+i+' data-rh="true" '+l+">"+A(s,o)+"":"<"+i+' data-rh="true">'+A(s,o)+""}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(t)},toString:function(){return T(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){var i,r,a;return i=e,r=t,a=n,r.reduce(function(e,t){var n=Object.keys(t).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,n){var i=void 0===t[n]?n:n+'="'+A(t[n],a)+'"';return e?e+" "+i:i},""),r=t.innerHTML||t.cssText||"",o=-1===z.indexOf(i);return e+"<"+i+' data-rh="true" '+n+(o?"/>":">"+r+"")},"")}}}},R=function(e){var t=e.baseTag,n=e.bodyAttributes,i=e.encode,r=e.htmlAttributes,a=e.noscriptTags,o=e.styleTags,l=e.title,s=e.titleAttributes,d=e.linkTags,c=e.metaTags,u=e.scriptTags,h={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var p,m,f,y,w,k,j,I=(m=(p=e).linkTags,f=p.scriptTags,y=p.encode,w=_(p.metaTags,b),k=_(m,x),j=_(f,v),{priorityMethods:{toComponent:function(){return[].concat(M(g.META,w.priority),M(g.LINK,k.priority),M(g.SCRIPT,j.priority))},toString:function(){return L(g.META,w.priority,y)+" "+L(g.LINK,k.priority,y)+" "+L(g.SCRIPT,j.priority,y)}},metaTags:w.default,linkTags:k.default,scriptTags:j.default});h=I.priorityMethods,d=I.linkTags,c=I.metaTags,u=I.scriptTags}return{priority:h,base:L(g.BASE,t,i),bodyAttributes:L("bodyAttributes",n,i),htmlAttributes:L("htmlAttributes",r,i),link:L(g.LINK,d,i),meta:L(g.META,c,i),noscript:L(g.NOSCRIPT,a,i),script:L(g.SCRIPT,u,i),style:L(g.STYLE,o,i),title:L(g.TITLE,{title:void 0===l?"":l,titleAttributes:s},i)}},$=[],B=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?$:n.instances},add:function(e){(n.canUseDOM?$:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?$:n.instances).indexOf(e);(n.canUseDOM?$:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=R({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},D=i.createContext({}),H=a().shape({setHelmet:a().func,helmetInstances:a().shape({get:a().func,add:a().func,remove:a().func})}),F="undefined"!=typeof document,W=function(e){function t(n){var i;return(i=e.call(this,n)||this).helmetData=new B(i.props.context,t.canUseDOM),i}return p(t,e),t.prototype.render=function(){return i.createElement(D.Provider,{value:this.helmetData.value},this.props.children)},t}(i.Component);W.canUseDOM=F,W.propTypes={context:a().shape({helmet:a().shape()}),children:a().node.isRequired},W.defaultProps={context:{}},W.displayName="HelmetProvider";var q=function(e,t){var n,i=document.head||document.querySelector(g.HEAD),r=i.querySelectorAll(e+"[data-rh]"),a=[].slice.call(r),o=[];return t&&t.length&&t.forEach(function(t){var i=document.createElement(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("innerHTML"===r?i.innerHTML=t.innerHTML:"cssText"===r?i.styleSheet?i.styleSheet.cssText=t.cssText:i.appendChild(document.createTextNode(t.cssText)):i.setAttribute(r,void 0===t[r]?"":t[r]));i.setAttribute("data-rh","true"),a.some(function(e,t){return n=t,i.isEqualNode(e)})?a.splice(n,1):o.push(i)}),a.forEach(function(e){return e.parentNode.removeChild(e)}),o.forEach(function(e){return i.appendChild(e)}),{oldTags:a,newTags:o}},U=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var i=n.getAttribute("data-rh"),r=i?i.split(","):[],a=[].concat(r),o=Object.keys(t),l=0;l=0;u-=1)n.removeAttribute(a[u]);r.length===a.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==o.join(",")&&n.setAttribute("data-rh",o.join(","))}},V=function(e,t){var n,i,r=e.baseTag,a=e.htmlAttributes,o=e.linkTags,l=e.metaTags,s=e.noscriptTags,d=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,h=e.title,p=e.titleAttributes;U(g.BODY,e.bodyAttributes),U(g.HTML,a),n=h,i=p,void 0!==n&&document.title!==n&&(document.title=C(n)),U(g.TITLE,i);var m={baseTag:q(g.BASE,r),linkTags:q(g.LINK,o),metaTags:q(g.META,l),noscriptTags:q(g.NOSCRIPT,s),scriptTags:q(g.SCRIPT,c),styleTags:q(g.STYLE,u)},f={},x={};Object.keys(m).forEach(function(e){var t=m[e],n=t.newTags,i=t.oldTags;n.length&&(f[e]=n),i.length&&(x[e]=m[e].oldTags)}),t&&t(),d(e,f,x)},G=null,Z=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,i=e.arrayTypeChildren;return h({},i,((t={})[n.type]=[].concat(i[n.type]||[],[h({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,i=e.child,r=e.newProps,a=e.newChildProps,o=e.nestedChildren;switch(i.type){case g.TITLE:return h({},r,((t={})[i.type]=o,t.titleAttributes=h({},a),t));case g.BODY:return h({},r,{bodyAttributes:h({},a)});case g.HTML:return h({},r,{htmlAttributes:h({},a)});default:return h({},r,((n={})[i.type]=h({},a),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=h({},t);return Object.keys(e).forEach(function(t){var i;n=h({},n,((i={})[t]=e[t],i))}),n},n.warnOnInvalidChildren=function(e,t){return d()(y.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+y.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),d()(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``} ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,r={};return i.Children.forEach(e,function(e){if(e&&e.props){var i=e.props,a=i.children,o=f(i,Y),l=Object.keys(o).reduce(function(e,t){return e[k[t]||t]=o[t],e},{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,a),s){case g.FRAGMENT:t=n.mapChildrenToProps(a,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:l,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:a})}}}),this.mapArrayTypeChildrenToProps(r,t)},n.render=function(){var e=this.props,t=e.children,n=f(e,K),r=h({},n),a=n.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!a||a instanceof B||(a=new B(a.context,a.instances)),a?i.createElement(Z,h({},r,{context:a.value,helmetData:void 0})):i.createElement(D.Consumer,null,function(e){return i.createElement(Z,h({},r,{context:e}))})},t}(i.Component);J.propTypes={base:a().object,bodyAttributes:a().object,children:a().oneOfType([a().arrayOf(a().node),a().node]),defaultTitle:a().string,defer:a().bool,encodeSpecialCharacters:a().bool,htmlAttributes:a().object,link:a().arrayOf(a().object),meta:a().arrayOf(a().object),noscript:a().arrayOf(a().object),onChangeClientState:a().func,script:a().arrayOf(a().object),style:a().arrayOf(a().object),title:a().string,titleAttributes:a().object,titleTemplate:a().string,prioritizeSeoTags:a().bool,helmetData:a().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},2897:function(e,t,n){"use strict";t.lazyWithPreload=void 0;var i,r=n(2363);function a(e){var t,n,i=(0,r.lazy)(e),a=(0,r.forwardRef)(function(e,n){var a=(0,r.useRef)(null!=t?t:i);return(0,r.createElement)(a.current,Object.assign(n?{ref:n}:{},e))});return a.preload=function(){return!n&&(n=e().then(function(e){return t=e.default})),n},a}t.lazyWithPreload=a},4251:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(538)).default;t.default=r},273:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(7520)).default;t.default=r},4580:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3610)).default;t.default=r},6586:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9551)).default;t.default=r},8960:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(7091)).default;t.default=r},1107:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9693)).default;t.default=r},9159:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9463)).default;t.default=r},6929:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3883)).default;t.default=r},8831:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(1337)).default;t.default=r},9549:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9455)).default;t.default=r},6397:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3847)).default;t.default=r},6778:function(e,t,n){"use strict";var i="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof n.g?n.g:{},r=function(){var e="Prism"in i,t=e?i.Prism:void 0;return function(){e?i.Prism=t:delete i.Prism,e=void 0,t=void 0}}();i.Prism={manual:!0,disableWorkerMessageHandler:!0};var a=n(4396),o=n(2668),l=n(3921),s=n(7264),d=n(7520),c=n(1860),u=n(9551);r();var h={}.hasOwnProperty;function p(){}p.prototype=l;var m=new p;function f(e){if("function"!=typeof e||!e.displayName)throw Error("Expected `function` for `grammar`, got `"+e+"`");void 0===m.languages[e.displayName]&&e(m)}e.exports=m,m.highlight=function(e,t){var n,i=l.highlight;if("string"!=typeof e)throw Error("Expected `string` for `value`, got `"+e+"`");if("Object"===m.util.type(t))n=t,t=null;else{if("string"!=typeof t)throw Error("Expected `string` for `name`, got `"+t+"`");if(h.call(m.languages,t))n=m.languages[t];else throw Error("Unknown language: `"+t+"` is not registered")}return i.call(this,e,n,t)},m.register=f,m.alias=function(e,t){var n,i,r,a,o=m.languages,l=e;for(n in t&&((l={})[e]=t),l)for(r=(i="string"==typeof(i=l[n])?[i]:i).length,a=-1;++a>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,o=0;o]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}e.exports=t,t.displayName="clike",t.aliases=[]},7520:function(e){"use strict";function t(e){var t,n,i;n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,(t=e).languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css,(i=t.languages.markup)&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}e.exports=t,t.displayName="css",t.aliases=[]},3610:function(e){"use strict";function t(e){var t,n;(t=e).languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]},Object.keys(n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"}).forEach(function(e){var i=n[e],r=[];!/^\w+$/.test(e)&&r.push(/\w+/.exec(e)[0]),"diff"===e&&r.push("bold"),t.languages.diff[e]={pattern:RegExp("^(?:["+i+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(e)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})}e.exports=t,t.displayName="diff",t.aliases=[]},9551:function(e){"use strict";function t(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|")+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}e.exports=t,t.displayName="javascript",t.aliases=["js"]},7091:function(e){"use strict";function t(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}e.exports=t,t.displayName="json",t.aliases=["webmanifest"]},7942:function(e){"use strict";function t(e){!function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function a(e,t){return RegExp(e=e.replace(//g,function(){return n}).replace(//g,function(){return i}).replace(//g,function(){return r}),t)}r=a(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(o).join(""):""},l=function(t){for(var n=[],i=0;i0&&n[n.length-1].tagName===o(r.content[0].content[1])&&n.pop():"/>"===r.content[r.content.length-1].content||n.push({tagName:o(r.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===r.type&&"{"===r.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?n[n.length-1].openedBraces--:a=!0),(a||"string"==typeof r)&&n.length>0&&0===n[n.length-1].openedBraces){var s=o(r);i0&&("string"==typeof t[i-1]||"plain-text"===t[i-1].type)&&(s=o(t[i-1])+s,t.splice(i-1,1),i--),t[i]=new e.Token("plain-text",s,null,s)}r.content&&"string"!=typeof r.content&&l(r.content)}};e.hooks.add("after-tokenize",function(e){if("jsx"===e.language||"tsx"===e.language)l(e.tokens)})}(e)}e.exports=t,t.displayName="jsx",t.aliases=[]},9693:function(e){"use strict";function t(e){e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}e.exports=t,t.displayName="less",t.aliases=[]},9463:function(e){"use strict";function t(e){!function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+a+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+a+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add("after-tokenize",function(e){if("markdown"===e.language||"md"===e.language)!function e(t){if(!!t&&"string"!=typeof t)for(var n=0,i=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(e)}e.exports=t,t.displayName="markdown",t.aliases=["md"]},7264:function(e){"use strict";function t(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var i={};i["language-"+n]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[n]},i.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:i}};r["language-"+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},e.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}e.exports=t,t.displayName="markup",t.aliases=["html","mathml","svg","xml","ssml","atom","rss"]},3883:function(e){"use strict";function t(e){var t,n,i;(t=e).languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule,n=/\$[-\w]+|#\{\$[-\w]+\}/,i=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:i}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:i,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}e.exports=t,t.displayName="sass",t.aliases=[]},1337:function(e){"use strict";function t(e){e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}e.exports=t,t.displayName="scss",t.aliases=[]},9455:function(e,t,n){"use strict";var i=n(7942),r=n(3847);function a(e){var t,n,a;e.register(i),e.register(r),n=(t=e).util.clone(t.languages.typescript),t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"],(a=t.languages.tsx.tag).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0}e.exports=a,a.displayName="tsx",a.aliases=[]},3847:function(e){"use strict";function t(e){var t,n;(t=e).languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"],n=t.languages.extend("typescript",{}),delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript}e.exports=t,t.displayName="typescript",t.aliases=["ts"]},5241:function(e){e.exports=function(e,t,n,i){var r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s1&&void 0!==arguments[1]?arguments[1]:{},i=window.Promise||function(e){function t(){}e(t,t)},r=function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,n=function(){var e={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},t=void 0,n=void 0;if(h.container){if(h.container instanceof Object)t=(e=p({},e,h.container)).width-e.left-e.right-2*h.margin,n=e.height-e.top-e.bottom-2*h.margin;else{var i=(f(h.container)?h.container:document.querySelector(h.container)).getBoundingClientRect();e=p({},e,{width:i.width,height:i.height,left:i.left,top:i.top})}}t=t||e.width-2*h.margin,n=n||e.height-2*h.margin;var r=m.zoomedHd||m.original,a=g(r)?t:r.naturalWidth||t,o=g(r)?n:r.naturalHeight||n,l=r.getBoundingClientRect(),s=l.top,d=l.left,c=l.width,u=l.height,x=Math.min(Math.min(Math.max(c,a),t)/c,Math.min(Math.max(u,o),n)/u),v=(-d+(t-c)/2+h.margin+e.left)/x,b=(-s+(n-u)/2+h.margin+e.top)/x,y="scale("+x+") translate3d("+v+"px, "+b+"px, 0)";m.zoomed.style.transform=y,m.zoomedHd&&(m.zoomedHd.style.transform=y)};return new i(function(e){if(t&&-1===s.indexOf(t)){e(k);return}if(m.zoomed){e(k);return}if(t)m.original=t;else if(s.length>0){var i=s;m.original=i[0]}else{e(k);return}if(m.original.dispatchEvent(y("medium-zoom:open",{detail:{zoom:k}})),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,c=!0,m.zoomed=b(m.original),document.body.appendChild(w),h.template){var r=f(h.template)?h.template:document.querySelector(h.template);m.template=document.createElement("div"),m.template.appendChild(r.content.cloneNode(!0)),document.body.appendChild(m.template)}if(m.original.parentElement&&"PICTURE"===m.original.parentElement.tagName&&m.original.currentSrc&&(m.zoomed.src=m.original.currentSrc),document.body.appendChild(m.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),m.original.classList.add("medium-zoom-image--hidden"),m.zoomed.classList.add("medium-zoom-image--opened"),m.zoomed.addEventListener("click",o),m.zoomed.addEventListener("transitionend",function t(){c=!1,m.zoomed.removeEventListener("transitionend",t),m.original.dispatchEvent(y("medium-zoom:opened",{detail:{zoom:k}})),e(k)}),m.original.getAttribute("data-zoom-src")){m.zoomedHd=m.zoomed.cloneNode(),m.zoomedHd.removeAttribute("srcset"),m.zoomedHd.removeAttribute("sizes"),m.zoomedHd.removeAttribute("loading"),m.zoomedHd.src=m.zoomed.getAttribute("data-zoom-src"),m.zoomedHd.onerror=function(){clearInterval(a),console.warn("Unable to reach the zoom image target "+m.zoomedHd.src),m.zoomedHd=null,n()};var a=setInterval(function(){m.zoomedHd.complete&&(clearInterval(a),m.zoomedHd.classList.add("medium-zoom-image--opened"),m.zoomedHd.addEventListener("click",o),document.body.appendChild(m.zoomedHd),n())},10)}else if(m.original.hasAttribute("srcset")){m.zoomedHd=m.zoomed.cloneNode(),m.zoomedHd.removeAttribute("sizes"),m.zoomedHd.removeAttribute("loading");var l=m.zoomedHd.addEventListener("load",function(){m.zoomedHd.removeEventListener("load",l),m.zoomedHd.classList.add("medium-zoom-image--opened"),m.zoomedHd.addEventListener("click",o),document.body.appendChild(m.zoomedHd),n()})}else n()})},o=function(){return new i(function(e){if(c||!m.original){e(k);return}c=!0,document.body.classList.remove("medium-zoom--opened"),m.zoomed.style.transform="",m.zoomedHd&&(m.zoomedHd.style.transform=""),m.template&&(m.template.style.transition="opacity 150ms",m.template.style.opacity=0),m.original.dispatchEvent(y("medium-zoom:close",{detail:{zoom:k}})),m.zoomed.addEventListener("transitionend",function t(){m.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(m.zoomed),m.zoomedHd&&document.body.removeChild(m.zoomedHd),document.body.removeChild(w),m.zoomed.classList.remove("medium-zoom-image--opened"),m.template&&document.body.removeChild(m.template),c=!1,m.zoomed.removeEventListener("transitionend",t),m.original.dispatchEvent(y("medium-zoom:closed",{detail:{zoom:k}})),m.original=null,m.zoomed=null,m.zoomedHd=null,m.template=null,e(k)})})},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target;return m.original?o():a({target:t})},s=[],d=[],c=!1,u=0,h=n,m={original:null,zoomed:null,zoomedHd:null,template:null};"[object Object]"===Object.prototype.toString.call(t)?h=t:(t||"string"==typeof t)&&r(t);var w=v((h=p({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},h)).background);document.addEventListener("click",function(e){var t=e.target;if(t===w){o();return}if(-1!==s.indexOf(t))l({target:t})}),document.addEventListener("keyup",function(e){var t=e.key||e.keyCode;("Escape"===t||"Esc"===t||27===t)&&o()}),document.addEventListener("scroll",function(){if(!c&&!!m.original){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(u-e)>h.scrollOffset&&setTimeout(o,150)}}),window.addEventListener("resize",o);var k={open:a,close:o,toggle:l,update:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.background&&(w.style.background=e.background),e.container&&e.container instanceof Object&&(e.container=p({},h.container,e.container)),e.template){var t=f(e.template)?e.template:document.querySelector(e.template);e.template=t}return h=p({},h,e),s.forEach(function(e){e.dispatchEvent(y("medium-zoom:update",{detail:{zoom:k}}))}),k},clone:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(p({},h,t))},attach:r,detach:function(){for(var e=arguments.length,t=Array(e),n=0;n0?t.reduce(function(e,t){return[].concat(e,x(t))},[]):s;return i.forEach(function(e){e.classList.remove("medium-zoom-image"),e.dispatchEvent(y("medium-zoom:detach",{detail:{zoom:k}}))}),s=s.filter(function(e){return -1===i.indexOf(e)}),k},on:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s.forEach(function(i){i.addEventListener("medium-zoom:"+e,t,n)}),d.push({type:"medium-zoom:"+e,listener:t,options:n}),k},off:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s.forEach(function(i){i.removeEventListener("medium-zoom:"+e,t,n)}),d=d.filter(function(n){return!(n.type==="medium-zoom:"+e&&n.listener.toString()===t.toString())}),k},getOptions:function(){return h},getImages:function(){return s},getZoomedImage:function(){return m.original}};return k};n("5981");let k=[[function(e){let{pathname:t}=(0,u.TH)(),{selector:n=".rspress-doc img",options:i={}}=e;return(0,r.useEffect)(()=>{let e;let t=setTimeout(()=>{e=w(document.querySelectorAll(n),{...i,background:"var(--rp-c-bg)"})},100);return()=>{clearTimeout(t),null==e||e.detach(),null==e||e.close()}},[t]),null},{}]],j=n("1411");n("1763");async function I(e){var t,i;let{routes:r}=n(6118),s=(0,c.fp)(r,e);if(s){let t=s[0].route,n=await t.preload(),r=(0,a.bw)(s[0].route.filePath),d=o.Z.pages.find(t=>{let n=e=>e.replace(/\/$/,"").toLowerCase();return(0,l.pV)(n(t.routePath),n(e))}),c=encodeURIComponent(r),u=(null===(i=n.default.__RSPRESS_PAGE_META)||void 0===i?void 0:i[c])||{},{toc:h=[],title:p="",frontmatter:m={},...f}=a.kv.test(t.filePath)?u:n;return{siteData:o.Z,page:{...f,pagePath:r,...d,pageType:(null==m?void 0:m.pageType)||"doc",title:p,frontmatter:m,toc:h}}}let d=o.Z.lang||"",u=(null===(t=o.Z.multiVersion)||void 0===t?void 0:t.default)||"";if(o.Z.lang&&"undefined"!=typeof window){let e=location.pathname.replace(o.Z.base,"").split("/").slice(0,2);if(o.Z.locales.length){let t=o.Z.locales.find(t=>{let{lang:n}=t;return e.includes(n)});t&&(d=t.lang)}if(o.Z.multiVersion.versions){let t=o.Z.multiVersion.versions.find(t=>e.includes(t));t&&(u=t)}}return{siteData:o.Z,page:{pagePath:"",pageType:"404",routePath:"/404",lang:d,frontmatter:{},title:"404",toc:[],version:u,_filepath:"",_relativePath:""}}}function P(e){let{helmetContext:t}=e,{setData:n,data:a}=(0,r.useContext)(s.R0),o=a.page.frontmatter||{},{pathname:d,search:c}=(0,u.TH)(),p=new URLSearchParams(c),m="globalUIComponents",f=!1===o[m]||"0"===p.get(m);return(0,r.useLayoutEffect)(()=>{(async function e(){try{let e=await I((0,l.Tm)(d));n(e)}catch(e){console.log(e)}})()},[d,n]),(0,i.jsxs)(h.B6,{context:t,children:[(0,i.jsx)(j.ZP.Layout,{}),!f&&k.map((e,t)=>{if(Array.isArray(e)){let[n,i]=e;return r.createElement(n,{key:t,...i})}return r.createElement(e,{key:t})})]})}let S=o.Z.ssg,{default:E,useThemeState:C}=n(2285);(async function e(){let e=document.getElementById("root"),t=async()=>{let e=await I((0,l.Tm)(window.location.pathname));return function(){let[t,n]=(0,r.useState)(e),[a,o]=C();return(0,i.jsx)(s.Ni.Provider,{value:(0,r.useMemo)(()=>({theme:a,setTheme:o}),[a,o]),children:(0,i.jsx)(s.R0.Provider,{value:(0,r.useMemo)(()=>({data:t,setData:n}),[t,n]),children:(0,i.jsx)(d.VK,{children:(0,i.jsx)(P,{})})})})}},o=await t();{let{createRoot:t,hydrateRoot:r}=n(417);(0,a.yv)()&&S?r(e,(0,i.jsx)(o,{})):t(e).render((0,i.jsx)(o,{}))}})().then(()=>{E.setup()})},4031:function(e,t,n){"use strict";n.d(t,{YE:()=>i.YE,WG:()=>i.WG,ZB:()=>i.ZB,Rg:()=>i.Rg,KO:()=>i.KO,OK:()=>i.OK,Ar:()=>i.Ar,rU:()=>i.rU,JL:()=>i.JL,Qn:()=>i.Qn,RY:()=>i.RY,mi:()=>i.mi,BZ:()=>i.BZ,xN:()=>i.xN,Ct:()=>i.Ct,zx:()=>i.zx,xK:()=>i.xK,mQ:()=>i.mQ,Vp:()=>i.Vp,of:()=>i.of,UQ:()=>i.UQ,AV:()=>i.AV,tx:()=>i.tx,ls:()=>i.ls,ZP:()=>i.ZP,TJ:()=>i.TJ,zh:()=>i.zh,s2:()=>i.s2,H_:()=>i.H_,NG:()=>i.NG,VA:()=>i.VA,eF:()=>i.eF,cY:()=>i.cY,CU:()=>i.CU,CF:()=>i.CF,YS:()=>i.YS,Vl:()=>i.Vl,M4:()=>i.M4,eE:()=>i.eE,WS:()=>i.WS,xB:()=>i.xB,Os:()=>i.Os,O9:()=>i.O9,qx:()=>i.qx,g2:()=>i.g2,SU:()=>i.SU,Qe:()=>i.Qe,y2:()=>i.y2,pU:()=>i.pU,ol:()=>i.ol,EG:()=>i.EG});let i=n("1411")},6118:function(e,t,n){"use strict";n.r(t),n.d(t,{routes:function(){return eW}});var i=n(2363),r=n(2897);let a=(0,r.lazyWithPreload)(()=>n.e("5864").then(n.bind(n,8051))),o=(0,r.lazyWithPreload)(()=>n.e("6677").then(n.bind(n,9146))),l=(0,r.lazyWithPreload)(()=>n.e("5816").then(n.bind(n,6834))),s=(0,r.lazyWithPreload)(()=>n.e("4457").then(n.bind(n,8810))),d=(0,r.lazyWithPreload)(()=>n.e("864").then(n.bind(n,2585))),c=(0,r.lazyWithPreload)(()=>n.e("6832").then(n.bind(n,5142))),u=(0,r.lazyWithPreload)(()=>n.e("9033").then(n.bind(n,963))),h=(0,r.lazyWithPreload)(()=>n.e("1415").then(n.bind(n,6047))),p=(0,r.lazyWithPreload)(()=>n.e("7790").then(n.bind(n,4967))),m=(0,r.lazyWithPreload)(()=>n.e("266").then(n.bind(n,8325))),f=(0,r.lazyWithPreload)(()=>n.e("4038").then(n.bind(n,1891))),g=(0,r.lazyWithPreload)(()=>n.e("8169").then(n.bind(n,9730))),x=(0,r.lazyWithPreload)(()=>n.e("5116").then(n.bind(n,6261))),v=(0,r.lazyWithPreload)(()=>n.e("768").then(n.bind(n,3188))),b=(0,r.lazyWithPreload)(()=>n.e("3452").then(n.bind(n,891))),y=(0,r.lazyWithPreload)(()=>n.e("7936").then(n.bind(n,6795))),w=(0,r.lazyWithPreload)(()=>n.e("4781").then(n.bind(n,3492))),k=(0,r.lazyWithPreload)(()=>n.e("2828").then(n.bind(n,9489))),j=(0,r.lazyWithPreload)(()=>n.e("1178").then(n.bind(n,1573))),I=(0,r.lazyWithPreload)(()=>n.e("7316").then(n.bind(n,765))),P=(0,r.lazyWithPreload)(()=>n.e("2932").then(n.bind(n,9573))),S=(0,r.lazyWithPreload)(()=>n.e("207").then(n.bind(n,5462))),E=(0,r.lazyWithPreload)(()=>n.e("5353").then(n.bind(n,4364))),C=(0,r.lazyWithPreload)(()=>n.e("1655").then(n.bind(n,5716))),_=(0,r.lazyWithPreload)(()=>n.e("3390").then(n.bind(n,2032))),N=(0,r.lazyWithPreload)(()=>n.e("1857").then(n.bind(n,8391))),z=(0,r.lazyWithPreload)(()=>n.e("5570").then(n.bind(n,6022))),A=(0,r.lazyWithPreload)(()=>n.e("1042").then(n.bind(n,5523))),T=(0,r.lazyWithPreload)(()=>n.e("4831").then(n.bind(n,789))),O=(0,r.lazyWithPreload)(()=>n.e("5279").then(n.bind(n,9635))),M=(0,r.lazyWithPreload)(()=>n.e("9481").then(n.bind(n,2497))),L=(0,r.lazyWithPreload)(()=>n.e("6156").then(n.bind(n,4570))),R=(0,r.lazyWithPreload)(()=>n.e("4813").then(n.bind(n,5673))),$=(0,r.lazyWithPreload)(()=>n.e("4595").then(n.bind(n,8380))),B=(0,r.lazyWithPreload)(()=>n.e("6186").then(n.bind(n,7126))),D=(0,r.lazyWithPreload)(()=>n.e("9251").then(n.bind(n,4513))),H=(0,r.lazyWithPreload)(()=>n.e("8820").then(n.bind(n,547))),F=(0,r.lazyWithPreload)(()=>n.e("6663").then(n.bind(n,1040))),W=(0,r.lazyWithPreload)(()=>n.e("3495").then(n.bind(n,5209))),q=(0,r.lazyWithPreload)(()=>n.e("1645").then(n.bind(n,6696))),U=(0,r.lazyWithPreload)(()=>n.e("9905").then(n.bind(n,9834))),V=(0,r.lazyWithPreload)(()=>n.e("3515").then(n.bind(n,3711))),G=(0,r.lazyWithPreload)(()=>n.e("6486").then(n.bind(n,191))),Z=(0,r.lazyWithPreload)(()=>n.e("5302").then(n.bind(n,3174))),Y=(0,r.lazyWithPreload)(()=>n.e("7047").then(n.bind(n,2515))),K=(0,r.lazyWithPreload)(()=>n.e("3241").then(n.bind(n,2693))),J=(0,r.lazyWithPreload)(()=>n.e("4639").then(n.bind(n,4642))),Q=(0,r.lazyWithPreload)(()=>n.e("2539").then(n.bind(n,2260))),X=(0,r.lazyWithPreload)(()=>n.e("5661").then(n.bind(n,6177))),ee=(0,r.lazyWithPreload)(()=>n.e("3978").then(n.bind(n,7971))),et=(0,r.lazyWithPreload)(()=>n.e("109").then(n.bind(n,1767))),en=(0,r.lazyWithPreload)(()=>n.e("2598").then(n.bind(n,5622))),ei=(0,r.lazyWithPreload)(()=>n.e("7129").then(n.bind(n,296))),er=(0,r.lazyWithPreload)(()=>n.e("3669").then(n.bind(n,2913))),ea=(0,r.lazyWithPreload)(()=>n.e("150").then(n.bind(n,5679))),eo=(0,r.lazyWithPreload)(()=>n.e("8052").then(n.bind(n,8388))),el=(0,r.lazyWithPreload)(()=>n.e("1571").then(n.bind(n,4677))),es=(0,r.lazyWithPreload)(()=>n.e("3110").then(n.bind(n,9083))),ed=(0,r.lazyWithPreload)(()=>n.e("3771").then(n.bind(n,1880))),ec=(0,r.lazyWithPreload)(()=>n.e("4503").then(n.bind(n,5687))),eu=(0,r.lazyWithPreload)(()=>n.e("6231").then(n.bind(n,751))),eh=(0,r.lazyWithPreload)(()=>n.e("3069").then(n.bind(n,9759))),ep=(0,r.lazyWithPreload)(()=>n.e("6111").then(n.bind(n,6578))),em=(0,r.lazyWithPreload)(()=>n.e("3238").then(n.bind(n,4764))),ef=(0,r.lazyWithPreload)(()=>n.e("1").then(n.bind(n,4993))),eg=(0,r.lazyWithPreload)(()=>n.e("2122").then(n.bind(n,6421))),ex=(0,r.lazyWithPreload)(()=>n.e("1286").then(n.bind(n,2583))),ev=(0,r.lazyWithPreload)(()=>n.e("9892").then(n.bind(n,6753))),eb=(0,r.lazyWithPreload)(()=>n.e("3264").then(n.bind(n,3708))),ey=(0,r.lazyWithPreload)(()=>n.e("7207").then(n.bind(n,7489))),ew=(0,r.lazyWithPreload)(()=>n.e("3884").then(n.bind(n,5550))),ek=(0,r.lazyWithPreload)(()=>n.e("9710").then(n.bind(n,9079))),ej=(0,r.lazyWithPreload)(()=>n.e("7410").then(n.bind(n,9126))),eI=(0,r.lazyWithPreload)(()=>n.e("1086").then(n.bind(n,7985))),eP=(0,r.lazyWithPreload)(()=>n.e("9382").then(n.bind(n,2128))),eS=(0,r.lazyWithPreload)(()=>n.e("4800").then(n.bind(n,3781))),eE=(0,r.lazyWithPreload)(()=>n.e("8603").then(n.bind(n,2259))),eC=(0,r.lazyWithPreload)(()=>n.e("2138").then(n.bind(n,7963))),e_=(0,r.lazyWithPreload)(()=>n.e("9513").then(n.bind(n,599))),eN=(0,r.lazyWithPreload)(()=>n.e("2125").then(n.bind(n,8845))),ez=(0,r.lazyWithPreload)(()=>n.e("1920").then(n.bind(n,9097))),eA=(0,r.lazyWithPreload)(()=>n.e("598").then(n.bind(n,3423))),eT=(0,r.lazyWithPreload)(()=>n.e("2546").then(n.bind(n,6982))),eO=(0,r.lazyWithPreload)(()=>n.e("4534").then(n.bind(n,8035))),eM=(0,r.lazyWithPreload)(()=>n.e("1787").then(n.bind(n,5308))),eL=(0,r.lazyWithPreload)(()=>n.e("6147").then(n.bind(n,790))),eR=(0,r.lazyWithPreload)(()=>n.e("7402").then(n.bind(n,2530))),e$=(0,r.lazyWithPreload)(()=>n.e("455").then(n.bind(n,5453))),eB=(0,r.lazyWithPreload)(()=>n.e("8477").then(n.bind(n,4243))),eD=(0,r.lazyWithPreload)(()=>n.e("8648").then(n.bind(n,8949))),eH=(0,r.lazyWithPreload)(()=>n.e("7244").then(n.bind(n,3442))),eF=(0,r.lazyWithPreload)(()=>n.e("9725").then(n.bind(n,6584))),eW=[{path:"/module-tools/en/api/config/build-config",element:i.createElement(a),filePath:"en/api/config/build-config.mdx",preload:async()=>(await a.preload(),n.e("5864").then(n.bind(n,8051))),lang:"en",version:""},{path:"/module-tools/en/api/config/build-preset",element:i.createElement(o),filePath:"en/api/config/build-preset.mdx",preload:async()=>(await o.preload(),n.e("6677").then(n.bind(n,9146))),lang:"en",version:""},{path:"/module-tools/en/api/config/dev",element:i.createElement(l),filePath:"en/api/config/dev.md",preload:async()=>(await l.preload(),n.e("5816").then(n.bind(n,6834))),lang:"en",version:""},{path:"/module-tools/en/api/config/plugins",element:i.createElement(s),filePath:"en/api/config/plugins.md",preload:async()=>(await s.preload(),n.e("4457").then(n.bind(n,8810))),lang:"en",version:""},{path:"/module-tools/en/api/",element:i.createElement(d),filePath:"en/api/index.md",preload:async()=>(await d.preload(),n.e("864").then(n.bind(n,2585))),lang:"en",version:""},{path:"/module-tools/en/api/plugin-api/plugin-hooks",element:i.createElement(c),filePath:"en/api/plugin-api/plugin-hooks.md",preload:async()=>(await c.preload(),n.e("6832").then(n.bind(n,5142))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-exception",element:i.createElement(u),filePath:"en/components/faq-build-exception.mdx",preload:async()=>(await u.preload(),n.e("9033").then(n.bind(n,963))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-other",element:i.createElement(h),filePath:"en/components/faq-build-other.mdx",preload:async()=>(await h.preload(),n.e("1415").then(n.bind(n,6047))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-product",element:i.createElement(p),filePath:"en/components/faq-build-product.mdx",preload:async()=>(await p.preload(),n.e("7790").then(n.bind(n,4967))),lang:"en",version:""},{path:"/module-tools/en/components/faq-storybook",element:i.createElement(m),filePath:"en/components/faq-storybook.mdx",preload:async()=>(await m.preload(),n.e("266").then(n.bind(n,8325))),lang:"en",version:""},{path:"/module-tools/en/components/publish-emo",element:i.createElement(f),filePath:"en/components/publish-emo.mdx",preload:async()=>(await f.preload(),n.e("4038").then(n.bind(n,1891))),lang:"en",version:""},{path:"/module-tools/en/components/register-esbuild-plugin",element:i.createElement(g),filePath:"en/components/register-esbuild-plugin.mdx",preload:async()=>(await g.preload(),n.e("8169").then(n.bind(n,9730))),lang:"en",version:""},{path:"/module-tools/en/components/release-module-doc",element:i.createElement(x),filePath:"en/components/release-module-doc.mdx",preload:async()=>(await x.preload(),n.e("5116").then(n.bind(n,6261))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/asset",element:i.createElement(v),filePath:"en/guide/advance/asset.mdx",preload:async()=>(await v.preload(),n.e("768").then(n.bind(n,3188))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/build-umd",element:i.createElement(b),filePath:"en/guide/advance/build-umd.mdx",preload:async()=>(await b.preload(),n.e("3452").then(n.bind(n,891))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/copy",element:i.createElement(y),filePath:"en/guide/advance/copy.md",preload:async()=>(await y.preload(),n.e("7936").then(n.bind(n,6795))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/external-dependency",element:i.createElement(w),filePath:"en/guide/advance/external-dependency.mdx",preload:async()=>(await w.preload(),n.e("4781").then(n.bind(n,3492))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-build",element:i.createElement(k),filePath:"en/guide/advance/in-depth-about-build.md",preload:async()=>(await k.preload(),n.e("2828").then(n.bind(n,9489))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-dev-command",element:i.createElement(j),filePath:"en/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await j.preload(),n.e("1178").then(n.bind(n,1573))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/before-getting-started",element:i.createElement(I),filePath:"en/guide/basic/before-getting-started.md",preload:async()=>(await I.preload(),n.e("7316").then(n.bind(n,765))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/command-preview",element:i.createElement(P),filePath:"en/guide/basic/command-preview.md",preload:async()=>(await P.preload(),n.e("2932").then(n.bind(n,9573))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/modify-output-product",element:i.createElement(S),filePath:"en/guide/basic/modify-output-product.md",preload:async()=>(await S.preload(),n.e("207").then(n.bind(n,5462))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/publish-your-project",element:i.createElement(E),filePath:"en/guide/basic/publish-your-project.mdx",preload:async()=>(await E.preload(),n.e("5353").then(n.bind(n,4364))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-micro-generator",element:i.createElement(C),filePath:"en/guide/basic/use-micro-generator.md",preload:async()=>(await C.preload(),n.e("1655").then(n.bind(n,5716))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-module-doc",element:i.createElement(_),filePath:"en/guide/basic/use-module-doc.mdx",preload:async()=>(await _.preload(),n.e("3390").then(n.bind(n,2032))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/using-storybook",element:i.createElement(N),filePath:"en/guide/basic/using-storybook.mdx",preload:async()=>(await N.preload(),n.e("1857").then(n.bind(n,8391))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/components",element:i.createElement(z),filePath:"en/guide/best-practices/components.mdx",preload:async()=>(await z.preload(),n.e("5570").then(n.bind(n,6022))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/use-tailwindcss",element:i.createElement(A),filePath:"en/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await A.preload(),n.e("1042").then(n.bind(n,5523))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/basic",element:i.createElement(T),filePath:"en/guide/faq/basic.mdx",preload:async()=>(await T.preload(),n.e("4831").then(n.bind(n,789))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/build",element:i.createElement(O),filePath:"en/guide/faq/build.mdx",preload:async()=>(await O.preload(),n.e("5279").then(n.bind(n,9635))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/",element:i.createElement(M),filePath:"en/guide/faq/index.md",preload:async()=>(await M.preload(),n.e("9481").then(n.bind(n,2497))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/storybook",element:i.createElement(L),filePath:"en/guide/faq/storybook.mdx",preload:async()=>(await L.preload(),n.e("6156").then(n.bind(n,4570))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/getting-started",element:i.createElement(R),filePath:"en/guide/intro/getting-started.mdx",preload:async()=>(await R.preload(),n.e("4813").then(n.bind(n,5673))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/welcome",element:i.createElement($),filePath:"en/guide/intro/welcome.md",preload:async()=>(await $.preload(),n.e("4595").then(n.bind(n,8380))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/why-module-engineering-solution",element:i.createElement(B),filePath:"en/guide/intro/why-module-engineering-solution.md",preload:async()=>(await B.preload(),n.e("6186").then(n.bind(n,7126))),lang:"en",version:""},{path:"/module-tools/en/",element:i.createElement(D),filePath:"en/index.md",preload:async()=>(await D.preload(),n.e("9251").then(n.bind(n,4513))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/getting-started",element:i.createElement(H),filePath:"en/plugins/guide/getting-started.mdx",preload:async()=>(await H.preload(),n.e("8820").then(n.bind(n,547))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/plugin-object",element:i.createElement(F),filePath:"en/plugins/guide/plugin-object.mdx",preload:async()=>(await F.preload(),n.e("6663").then(n.bind(n,1040))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/setup-function",element:i.createElement(W),filePath:"en/plugins/guide/setup-function.mdx",preload:async()=>(await W.preload(),n.e("3495").then(n.bind(n,5209))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/overview",element:i.createElement(q),filePath:"en/plugins/official-list/overview.md",preload:async()=>(await q.preload(),n.e("1645").then(n.bind(n,6696))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-babel",element:i.createElement(U),filePath:"en/plugins/official-list/plugin-babel.mdx",preload:async()=>(await U.preload(),n.e("9905").then(n.bind(n,9834))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-banner",element:i.createElement(V),filePath:"en/plugins/official-list/plugin-banner.mdx",preload:async()=>(await V.preload(),n.e("3515").then(n.bind(n,3711))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-import",element:i.createElement(G),filePath:"en/plugins/official-list/plugin-import.mdx",preload:async()=>(await G.preload(),n.e("6486").then(n.bind(n,191))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-node-polyfill",element:i.createElement(Z),filePath:"en/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await Z.preload(),n.e("5302").then(n.bind(n,3174))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-polyfill",element:i.createElement(Y),filePath:"en/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await Y.preload(),n.e("7047").then(n.bind(n,2515))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-vue",element:i.createElement(K),filePath:"en/plugins/official-list/plugin-vue.mdx",preload:async()=>(await K.preload(),n.e("3241").then(n.bind(n,2693))),lang:"en",version:""},{path:"/module-tools/api/config/build-config",element:i.createElement(J),filePath:"zh/api/config/build-config.mdx",preload:async()=>(await J.preload(),n.e("4639").then(n.bind(n,4642))),lang:"zh",version:""},{path:"/module-tools/api/config/build-preset",element:i.createElement(Q),filePath:"zh/api/config/build-preset.mdx",preload:async()=>(await Q.preload(),n.e("2539").then(n.bind(n,2260))),lang:"zh",version:""},{path:"/module-tools/api/config/dev",element:i.createElement(X),filePath:"zh/api/config/dev.md",preload:async()=>(await X.preload(),n.e("5661").then(n.bind(n,6177))),lang:"zh",version:""},{path:"/module-tools/api/config/plugins",element:i.createElement(ee),filePath:"zh/api/config/plugins.md",preload:async()=>(await ee.preload(),n.e("3978").then(n.bind(n,7971))),lang:"zh",version:""},{path:"/module-tools/api/",element:i.createElement(et),filePath:"zh/api/index.md",preload:async()=>(await et.preload(),n.e("109").then(n.bind(n,1767))),lang:"zh",version:""},{path:"/module-tools/api/plugin-api/plugin-hooks",element:i.createElement(en),filePath:"zh/api/plugin-api/plugin-hooks.md",preload:async()=>(await en.preload(),n.e("2598").then(n.bind(n,5622))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-exception",element:i.createElement(ei),filePath:"zh/components/faq-build-exception.mdx",preload:async()=>(await ei.preload(),n.e("7129").then(n.bind(n,296))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-other",element:i.createElement(er),filePath:"zh/components/faq-build-other.mdx",preload:async()=>(await er.preload(),n.e("3669").then(n.bind(n,2913))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-product",element:i.createElement(ea),filePath:"zh/components/faq-build-product.mdx",preload:async()=>(await ea.preload(),n.e("150").then(n.bind(n,5679))),lang:"zh",version:""},{path:"/module-tools/components/faq-storybook",element:i.createElement(eo),filePath:"zh/components/faq-storybook.mdx",preload:async()=>(await eo.preload(),n.e("8052").then(n.bind(n,8388))),lang:"zh",version:""},{path:"/module-tools/components/publish-emo",element:i.createElement(el),filePath:"zh/components/publish-emo.mdx",preload:async()=>(await el.preload(),n.e("1571").then(n.bind(n,4677))),lang:"zh",version:""},{path:"/module-tools/components/register-esbuild-plugin",element:i.createElement(es),filePath:"zh/components/register-esbuild-plugin.mdx",preload:async()=>(await es.preload(),n.e("3110").then(n.bind(n,9083))),lang:"zh",version:""},{path:"/module-tools/components/release-module-doc",element:i.createElement(ed),filePath:"zh/components/release-module-doc.mdx",preload:async()=>(await ed.preload(),n.e("3771").then(n.bind(n,1880))),lang:"zh",version:""},{path:"/module-tools/guide/advance/asset",element:i.createElement(ec),filePath:"zh/guide/advance/asset.mdx",preload:async()=>(await ec.preload(),n.e("4503").then(n.bind(n,5687))),lang:"zh",version:""},{path:"/module-tools/guide/advance/build-umd",element:i.createElement(eu),filePath:"zh/guide/advance/build-umd.mdx",preload:async()=>(await eu.preload(),n.e("6231").then(n.bind(n,751))),lang:"zh",version:""},{path:"/module-tools/guide/advance/copy",element:i.createElement(eh),filePath:"zh/guide/advance/copy.md",preload:async()=>(await eh.preload(),n.e("3069").then(n.bind(n,9759))),lang:"zh",version:""},{path:"/module-tools/guide/advance/external-dependency",element:i.createElement(ep),filePath:"zh/guide/advance/external-dependency.mdx",preload:async()=>(await ep.preload(),n.e("6111").then(n.bind(n,6578))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-build",element:i.createElement(em),filePath:"zh/guide/advance/in-depth-about-build.md",preload:async()=>(await em.preload(),n.e("3238").then(n.bind(n,4764))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-dev-command",element:i.createElement(ef),filePath:"zh/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await ef.preload(),n.e("1").then(n.bind(n,4993))),lang:"zh",version:""},{path:"/module-tools/guide/basic/before-getting-started",element:i.createElement(eg),filePath:"zh/guide/basic/before-getting-started.md",preload:async()=>(await eg.preload(),n.e("2122").then(n.bind(n,6421))),lang:"zh",version:""},{path:"/module-tools/guide/basic/command-preview",element:i.createElement(ex),filePath:"zh/guide/basic/command-preview.md",preload:async()=>(await ex.preload(),n.e("1286").then(n.bind(n,2583))),lang:"zh",version:""},{path:"/module-tools/guide/basic/modify-output-product",element:i.createElement(ev),filePath:"zh/guide/basic/modify-output-product.md",preload:async()=>(await ev.preload(),n.e("9892").then(n.bind(n,6753))),lang:"zh",version:""},{path:"/module-tools/guide/basic/publish-your-project",element:i.createElement(eb),filePath:"zh/guide/basic/publish-your-project.mdx",preload:async()=>(await eb.preload(),n.e("3264").then(n.bind(n,3708))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-micro-generator",element:i.createElement(ey),filePath:"zh/guide/basic/use-micro-generator.md",preload:async()=>(await ey.preload(),n.e("7207").then(n.bind(n,7489))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-module-doc",element:i.createElement(ew),filePath:"zh/guide/basic/use-module-doc.mdx",preload:async()=>(await ew.preload(),n.e("3884").then(n.bind(n,5550))),lang:"zh",version:""},{path:"/module-tools/guide/basic/using-storybook",element:i.createElement(ek),filePath:"zh/guide/basic/using-storybook.mdx",preload:async()=>(await ek.preload(),n.e("9710").then(n.bind(n,9079))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/components",element:i.createElement(ej),filePath:"zh/guide/best-practices/components.mdx",preload:async()=>(await ej.preload(),n.e("7410").then(n.bind(n,9126))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/use-tailwindcss",element:i.createElement(eI),filePath:"zh/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await eI.preload(),n.e("1086").then(n.bind(n,7985))),lang:"zh",version:""},{path:"/module-tools/guide/faq/basic",element:i.createElement(eP),filePath:"zh/guide/faq/basic.mdx",preload:async()=>(await eP.preload(),n.e("9382").then(n.bind(n,2128))),lang:"zh",version:""},{path:"/module-tools/guide/faq/build",element:i.createElement(eS),filePath:"zh/guide/faq/build.mdx",preload:async()=>(await eS.preload(),n.e("4800").then(n.bind(n,3781))),lang:"zh",version:""},{path:"/module-tools/guide/faq/",element:i.createElement(eE),filePath:"zh/guide/faq/index.md",preload:async()=>(await eE.preload(),n.e("8603").then(n.bind(n,2259))),lang:"zh",version:""},{path:"/module-tools/guide/faq/storybook",element:i.createElement(eC),filePath:"zh/guide/faq/storybook.mdx",preload:async()=>(await eC.preload(),n.e("2138").then(n.bind(n,7963))),lang:"zh",version:""},{path:"/module-tools/guide/intro/getting-started",element:i.createElement(e_),filePath:"zh/guide/intro/getting-started.mdx",preload:async()=>(await e_.preload(),n.e("9513").then(n.bind(n,599))),lang:"zh",version:""},{path:"/module-tools/guide/intro/welcome",element:i.createElement(eN),filePath:"zh/guide/intro/welcome.md",preload:async()=>(await eN.preload(),n.e("2125").then(n.bind(n,8845))),lang:"zh",version:""},{path:"/module-tools/guide/intro/why-module-engineering-solution",element:i.createElement(ez),filePath:"zh/guide/intro/why-module-engineering-solution.md",preload:async()=>(await ez.preload(),n.e("1920").then(n.bind(n,9097))),lang:"zh",version:""},{path:"/module-tools/",element:i.createElement(eA),filePath:"zh/index.md",preload:async()=>(await eA.preload(),n.e("598").then(n.bind(n,3423))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/getting-started",element:i.createElement(eT),filePath:"zh/plugins/guide/getting-started.mdx",preload:async()=>(await eT.preload(),n.e("2546").then(n.bind(n,6982))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/plugin-object",element:i.createElement(eO),filePath:"zh/plugins/guide/plugin-object.mdx",preload:async()=>(await eO.preload(),n.e("4534").then(n.bind(n,8035))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/setup-function",element:i.createElement(eM),filePath:"zh/plugins/guide/setup-function.mdx",preload:async()=>(await eM.preload(),n.e("1787").then(n.bind(n,5308))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/overview",element:i.createElement(eL),filePath:"zh/plugins/official-list/overview.md",preload:async()=>(await eL.preload(),n.e("6147").then(n.bind(n,790))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-babel",element:i.createElement(eR),filePath:"zh/plugins/official-list/plugin-babel.mdx",preload:async()=>(await eR.preload(),n.e("7402").then(n.bind(n,2530))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-banner",element:i.createElement(e$),filePath:"zh/plugins/official-list/plugin-banner.mdx",preload:async()=>(await e$.preload(),n.e("455").then(n.bind(n,5453))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-import",element:i.createElement(eB),filePath:"zh/plugins/official-list/plugin-import.mdx",preload:async()=>(await eB.preload(),n.e("8477").then(n.bind(n,4243))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-node-polyfill",element:i.createElement(eD),filePath:"zh/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await eD.preload(),n.e("8648").then(n.bind(n,8949))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-polyfill",element:i.createElement(eH),filePath:"zh/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await eH.preload(),n.e("7244").then(n.bind(n,3442))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-vue",element:i.createElement(eF),filePath:"zh/plugins/official-list/plugin-vue.mdx",preload:async()=>(await eF.preload(),n.e("9725").then(n.bind(n,6584))),lang:"zh",version:""}]},6780:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});let i={title:"Modern.js Module",description:"",icon:"https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png",themeConfig:{footer:{message:"Copyright \xa9 2023 ByteDance."},socialLinks:[{icon:"github",mode:"link",content:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools"}],locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],editLink:{docRepoBaseUrl:"https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs",text:"Edit this page on GitHub"}},base:"/module-tools/",lang:"zh",locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],logo:"",logoText:"",ssg:!0,multiVersion:{default:"",versions:[]},search:{},pages:[{title:"buildConfig",routePath:"/module-tools/en/api/config/build-config",lang:"en",toc:[{text:"alias",id:"alias",depth:2,charIndex:378},{text:"asset",id:"asset",depth:2,charIndex:1054},{text:"asset.name",id:"assetname",depth:2,charIndex:1113},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:1571},{text:"asset.path",id:"assetpath",depth:2,charIndex:2045},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:2149},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:2336},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:2783},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:2901},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:3018},{text:"autoExtension",id:"autoextension",depth:2,charIndex:3299},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:4498},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:5006},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:5142},{text:"banner",id:"banner",depth:2,charIndex:5273},{text:"buildType",id:"buildtype",depth:2,charIndex:5514},{text:"copy",id:"copy",depth:2,charIndex:5674},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:5850},{text:"copy.options",id:"copyoptions",depth:2,charIndex:5908},{text:"define",id:"define",depth:2,charIndex:6133},{text:"dts",id:"dts",depth:2,charIndex:7312},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:7435},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:7919},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:8081},{text:"dts.only",id:"dtsonly",depth:2,charIndex:8508},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:8664},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:8793},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:9225},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:10401},{text:"externals",id:"externals",depth:2,charIndex:10923},{text:"footer",id:"footer",depth:2,charIndex:11113},{text:"format",id:"format",depth:2,charIndex:11209},{text:"format: esm",id:"format-esm",depth:3,charIndex:11396},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:11536},{text:"format: iife",id:"format-iife",depth:3,charIndex:11732},{text:"format: umd",id:"format-umd",depth:3,charIndex:12026},{text:"hooks",id:"hooks",depth:2,charIndex:12329},{text:"input",id:"input",depth:2,charIndex:12816},{text:"jsx",id:"jsx",depth:2,charIndex:13845},{text:"metafile",id:"metafile",depth:2,charIndex:14376},{text:"minify",id:"minify",depth:2,charIndex:14805},{text:"outDir",id:"outdir",depth:2,charIndex:14948},{text:"platform",id:"platform",depth:2,charIndex:15042},{text:"redirect",id:"redirect",depth:2,charIndex:15273},{text:"resolve",id:"resolve",depth:2,charIndex:15789},{text:"resolve.alias",id:"resolvealias",depth:3,charIndex:15834},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:16509},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:17002},{text:"shims",id:"shims",depth:2,charIndex:17467},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:17888},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:18737},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:18995},{text:"sourceType",id:"sourcetype",depth:2,charIndex:19106},{text:"splitting",id:"splitting",depth:2,charIndex:19333},{text:"style",id:"style",depth:2,charIndex:19496},{text:"style.less",id:"styleless",depth:2,charIndex:19544},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:19586},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:19711},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:19832},{text:"style.sass",id:"stylesass",depth:2,charIndex:20177},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:20220},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:20326},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:20458},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:20798},{text:"style.inject",id:"styleinject",depth:2,charIndex:21146},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:22159},{text:"style.modules",id:"stylemodules",depth:2,charIndex:22506},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:22806},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3,charIndex:22920},{text:"Type",id:"type",depth:3,charIndex:23129},{text:"Notes",id:"notes",depth:3,charIndex:23434},{text:"target",id:"target",depth:2,charIndex:24017},{text:"transformImport",id:"transformimport",depth:2,charIndex:24381},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:24737},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:25238},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:25343},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:25654}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/en/api/config/build-preset",lang:"en",toc:[{text:"`npm-library`",id:"npm-library",depth:3,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:3,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:3,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:3,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:3,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:1651}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/en/api/config/dev",lang:"en",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:93},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:239},{text:"Configure Manager App",id:"configure-manager-app",depth:4,charIndex:506},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:686}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/en/api/config/plugins",lang:"en",toc:[{text:"Plugin Execution Order",id:"plugin-execution-order",depth:2,charIndex:140},{text:"Developing Plugins",id:"developing-plugins",depth:2,charIndex:584},{text:"Example",id:"example",depth:2,charIndex:680},{text:"Using Plugins from npm",id:"using-plugins-from-npm",depth:3,charIndex:691},{text:"Using Local Plugins",id:"using-local-plugins",depth:4,charIndex:837},{text:"Plugin Configuration",id:"plugin-configuration",depth:3,charIndex:960}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/api/config/plugins.md"},{title:"Overview",routePath:"/module-tools/en/api/",lang:"en",toc:[],frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1},version:"",_relativePath:"en/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/en/api/plugin-api/plugin-hooks",lang:"en",toc:[{text:"Config hooks",id:"config-hooks",depth:2,charIndex:509},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"build hooks",id:"build-hooks",depth:2,charIndex:596},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2,charIndex:1494},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"Dev Hooks",id:"dev-hooks",depth:2,charIndex:2796},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/en/components/faq-build-exception",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-other",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-product",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/en/components/faq-storybook",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/en/components/publish-emo",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/en/components/register-esbuild-plugin",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/en/components/release-module-doc",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/release-module-doc.mdx"},{title:"Handle static assets",routePath:"/module-tools/en/guide/advance/asset",lang:"en",toc:[{text:"Default behavior",id:"default-behavior",depth:2,charIndex:139},{text:"Example",id:"example",depth:2,charIndex:571}],frontmatter:{sidebar_position:6},version:"",_relativePath:"en/guide/advance/asset.mdx"},{title:"Build umd artifacts",routePath:"/module-tools/en/guide/advance/build-umd",lang:"en",toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2,charIndex:412},{text:"Example",id:"example",depth:3,charIndex:716},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3,charIndex:1171},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2,charIndex:1831}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/advance/build-umd.mdx"},{title:"Use the Copy Tools",routePath:"/module-tools/en/guide/advance/copy",lang:"en",toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2,charIndex:171},{text:"API Description",id:"api-description",depth:2,charIndex:335},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2,charIndex:1783},{text:"Copying Files",id:"copying-files",depth:3,charIndex:1818},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3,charIndex:1837},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3,charIndex:1871},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3,charIndex:1912},{text:"Using Glob",id:"using-glob",depth:3,charIndex:1948}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/advance/copy.md"},{title:"Handle third-party dependencies",routePath:"/module-tools/en/guide/advance/external-dependency",lang:"en",toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2,charIndex:811},{text:"Example",id:"example",depth:3,charIndex:1373},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2,charIndex:1643}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/advance/external-dependency.mdx"},{title:"In-depth understanding of build",routePath:"/module-tools/en/guide/advance/in-depth-about-build",lang:"en",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"use swc",id:"use-swc",depth:2,charIndex:2845},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2,charIndex:3803},{text:"Hook type",id:"hook-type",depth:3,charIndex:4183},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:4195},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:4334},{text:"Hook API",id:"hook-api",depth:3,charIndex:4431},{text:"load",id:"load",depth:4,charIndex:4442},{text:"transform",id:"transform",depth:4,charIndex:4626},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:4837},{text:"dts",id:"dts",depth:2,charIndex:5071},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3,charIndex:5154},{text:"Build type files",id:"build-type-files",depth:3,charIndex:5357},{text:"Alias Conversion",id:"alias-conversion",depth:3,charIndex:6424},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3,charIndex:-1},{text:"Build process",id:"build-process",depth:2,charIndex:6764},{text:"Build errors",id:"build-errors",depth:2,charIndex:7057},{text:"Debug mode",id:"debug-mode",depth:2,charIndex:7582}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/advance/in-depth-about-build.md"},{title:"In-depth understanding of the dev command",routePath:"/module-tools/en/guide/advance/in-depth-about-dev-command",lang:"en",toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2,charIndex:92},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2,charIndex:806}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/advance/in-depth-about-dev-command.md"},{title:"Before you start",routePath:"/module-tools/en/guide/basic/before-getting-started",lang:"en",toc:[{text:"Environment preparation",id:"environment-preparation",depth:2,charIndex:3},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2,charIndex:424},{text:"npm package type project",id:"npm-package-type-project",depth:2,charIndex:906},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2,charIndex:1922},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2,charIndex:3606},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3,charIndex:3643},{text:"`scripts`",id:"scripts",depth:3,charIndex:-1},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:5883},{text:"npm package manager",id:"npm-package-manager",depth:2,charIndex:6585},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2,charIndex:6850}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/basic/before-getting-started.md"},{title:"CLI Commands",routePath:"/module-tools/en/guide/basic/command-preview",lang:"en",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/basic/command-preview.md"},{title:"Modify the output",routePath:"/module-tools/en/guide/basic/modify-output-product",lang:"en",toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2,charIndex:3},{text:"buildPreset",id:"buildpreset",depth:2,charIndex:818},{text:"buildConfig",id:"buildconfig",depth:2,charIndex:1639},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2,charIndex:4390}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/basic/modify-output-product.md"},{title:"Versioning and Publishing",routePath:"/module-tools/en/guide/basic/publish-your-project",lang:"en",toc:[{text:"Tracking changes",id:"tracking-changes",depth:2,charIndex:610},{text:"Version update",id:"version-update",depth:2,charIndex:1355},{text:"Publish",id:"publish",depth:2,charIndex:1780},{text:"Pre-releases",id:"pre-releases",depth:2,charIndex:2468}],frontmatter:{sidebar_position:7},version:"",_relativePath:"en/guide/basic/publish-your-project.mdx"},{title:"Using the Microgenerator",routePath:"/module-tools/en/guide/basic/use-micro-generator",lang:"en",toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2,charIndex:431},{text:"Storybook",id:"storybook",depth:2,charIndex:895},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2,charIndex:1243},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2,charIndex:1528}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/basic/use-micro-generator.md"},{title:"Developing Module documentation",routePath:"/module-tools/en/guide/basic/use-module-doc",lang:"en",toc:[{text:"Before we start",id:"before-we-start",depth:2,charIndex:98},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3,charIndex:117},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3,charIndex:451},{text:"Basic site structure",id:"basic-site-structure",depth:2,charIndex:686},{text:"Configure sidebar",id:"configure-sidebar",depth:3,charIndex:1493},{text:"Writing Documentation",id:"writing-documentation",depth:2,charIndex:2109},{text:"Component preview",id:"component-preview",depth:2,charIndex:2329},{text:"Example",id:"example",depth:3,charIndex:2514},{text:"Mobile Preview",id:"mobile-preview",depth:3,charIndex:3121},{text:"Using external demos",id:"using-external-demos",depth:3,charIndex:3451},{text:"Using built-in components",id:"using-built-in-components",depth:2,charIndex:3691},{text:"API",id:"api",depth:3,charIndex:3837},{text:"Parse file",id:"parse-file",depth:4,charIndex:3883},{text:"Content generation",id:"content-generation",depth:4,charIndex:3981},{text:"Using the component",id:"using-the-component",depth:4,charIndex:5005},{text:"Overview",id:"overview",depth:3,charIndex:5154},{text:"Plugin options",id:"plugin-options",depth:2,charIndex:5675},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:5693},{text:"doc",id:"doc",depth:3,charIndex:5817},{text:"entries",id:"entries",depth:3,charIndex:5833},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:6040},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:6320},{text:"previewMode",id:"previewmode",depth:3,charIndex:6408},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:6599},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:6746},{text:"Scripts",id:"scripts",depth:2,charIndex:6967},{text:"Advanced guide",id:"advanced-guide",depth:2,charIndex:7130}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/use-module-doc.mdx"},{title:"Using Storybook",routePath:"/module-tools/en/guide/basic/using-storybook",lang:"en",toc:[{text:"V7 (Recommended)",id:"v7-recommended",depth:2,charIndex:511},{text:"Enable Storybook",id:"enable-storybook",depth:3,charIndex:531},{text:"Enable Debug output",id:"enable-debug-output",depth:3,charIndex:985},{text:"Enable Rspack build",id:"enable-rspack-build",depth:3,charIndex:2036},{text:"Configurations",id:"configurations",depth:3,charIndex:2361},{text:"bundler",id:"bundler",depth:4,charIndex:2441},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:2579},{text:"Command",id:"command",depth:3,charIndex:2782},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:2850},{text:"storybook build",id:"storybook-build",depth:4,charIndex:2890},{text:"Migrate from V6 to V7",id:"migrate-from-v6-to-v7",depth:2,charIndex:2948},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:3767},{text:"Start Storybook",id:"start-storybook",depth:3,charIndex:4013},{text:"Configure Storybook",id:"configure-storybook",depth:3,charIndex:4352},{text:"Build Storybook Output",id:"build-storybook-output",depth:3,charIndex:5092}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/using-storybook.mdx"},{title:"Developing Components",routePath:"/module-tools/en/guide/best-practices/components",lang:"en",toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2,charIndex:93},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2,charIndex:406},{text:"Developing Styles",id:"developing-styles",depth:2,charIndex:505},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:711},{text:"Less",id:"less",depth:3,charIndex:1098},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:1251},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:1414},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:1488},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2,charIndex:1852},{text:"Releasing components",id:"releasing-components",depth:2,charIndex:2666}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/best-practices/components.mdx"},{title:"Using Tailwind CSS",routePath:"/module-tools/en/guide/best-practices/use-tailwindcss",lang:"en",toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2,charIndex:252},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2,charIndex:1105},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3,charIndex:1889},{text:"Build Modes",id:"build-modes",depth:2,charIndex:2460},{text:"Bundle Mode",id:"bundle-mode",depth:3,charIndex:2728},{text:"Bundleless Mode",id:"bundleless-mode",depth:3,charIndex:3091},{text:"Class Name Prefix",id:"class-name-prefix",depth:2,charIndex:3254},{text:"Usage Guide",id:"usage-guide",depth:2,charIndex:3641},{text:"HTML Class Names",id:"html-class-names",depth:3,charIndex:3703},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:4211},{text:"Less",id:"less",depth:4,charIndex:4413},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/best-practices/use-tailwindcss.mdx"},{title:"General Questions",routePath:"/module-tools/en/guide/faq/basic",lang:"en",toc:[{text:"What is the relationship between Modern.js Module and Rsbuild?",id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",depth:2,charIndex:3},{text:"Can Modern.js Module use webpack plugins or loaders?",id:"can-modernjs-module-use-webpack-plugins-or-loaders",depth:2,charIndex:210}],frontmatter:{},version:"",_relativePath:"en/guide/faq/basic.mdx"},{title:"Build FAQ",routePath:"/module-tools/en/guide/faq/build",lang:"en",toc:[{text:"Product FAQ",id:"product-faq",depth:2,charIndex:301},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3,charIndex:316},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:2578},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2,charIndex:2995},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:3013},{text:"Problem Description",id:"problem-description",depth:4,charIndex:3059},{text:"Solution",id:"solution",depth:4,charIndex:3287},{text:"Reference Links",id:"reference-links",depth:4,charIndex:3792},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:4560},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:5206},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3,charIndex:-1},{text:"Other FAQ",id:"other-faq",depth:2,charIndex:5958},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3,charIndex:5971},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3,charIndex:6445},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3,charIndex:7173}],frontmatter:{},version:"",_relativePath:"en/guide/faq/build.mdx"},{title:"FAQ",routePath:"/module-tools/en/guide/faq/",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/guide/faq/index.md"},{title:"Storybook FAQ",routePath:"/module-tools/en/guide/faq/storybook",lang:"en",toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2,charIndex:3},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2,charIndex:104},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:519},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2,charIndex:681},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2,charIndex:900},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2,charIndex:1200},{text:"Tailwind CSS doesn't work in Storybook",id:"tailwind-css-doesnt-work-in-storybook",depth:2,charIndex:1585}],frontmatter:{},version:"",_relativePath:"en/guide/faq/storybook.mdx"},{title:"Quick Start",routePath:"/module-tools/en/guide/intro/getting-started",lang:"en",toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2,charIndex:3},{text:"Create new project",id:"create-new-project",depth:3,charIndex:209},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3,charIndex:855},{text:"Core npm Package",id:"core-npm-package",depth:3,charIndex:1577},{text:"View official example",id:"view-official-example",depth:3,charIndex:2272},{text:"Let's get started",id:"lets-get-started",depth:2,charIndex:2407}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/intro/getting-started.mdx"},{title:"Welcome to Modern.js Module",routePath:"/module-tools/en/guide/intro/welcome",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/intro/welcome.md"},{title:"Why you need Modern.js Module",routePath:"/module-tools/en/guide/intro/why-module-engineering-solution",lang:"en",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/en/",lang:"en",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Lint: Code Formatting",details:"Built-in ESLint rules for rich scenarios.",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"en/index.md"},{title:"Quick Start",routePath:"/module-tools/en/plugins/guide/getting-started",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/plugins/guide/getting-started.mdx"},{title:"Plugin Object",routePath:"/module-tools/en/plugins/guide/plugin-object",lang:"en",toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2,charIndex:570},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2,charIndex:741}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/plugins/guide/plugin-object.mdx"},{title:"Setup function",routePath:"/module-tools/en/plugins/guide/setup-function",lang:"en",toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2,charIndex:173},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2,charIndex:993},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2,charIndex:1434}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/plugins/guide/setup-function.mdx"},{title:"Overview",routePath:"/module-tools/en/plugins/official-list/overview",lang:"en",toc:[{text:"Official Plugins",id:"official-plugins",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/overview.md"},{title:"Babel Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-babel",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:110},{text:"Install",id:"install",depth:3,charIndex:125},{text:"Register",id:"register",depth:3,charIndex:136},{text:"Config",id:"config",depth:2,charIndex:372}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-babel.mdx"},{title:"Banner Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-banner",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:89},{text:"Install",id:"install",depth:3,charIndex:104},{text:"Register",id:"register",depth:3,charIndex:115},{text:"Example",id:"example",depth:2,charIndex:271},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3,charIndex:282},{text:"Configuration",id:"configuration",depth:2,charIndex:337},{text:"banner",id:"banner",depth:3,charIndex:365},{text:"footer",id:"footer",depth:3,charIndex:505}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-banner.mdx"},{title:"Import Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-import",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:230},{text:"Install",id:"install",depth:3,charIndex:245},{text:"Register",id:"register",depth:3,charIndex:256},{text:"Configurations",id:"configurations",depth:2,charIndex:413},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:443},{text:"Notes",id:"notes",depth:2,charIndex:602}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-node-polyfill",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:460},{text:"Install",id:"install",depth:3,charIndex:475},{text:"Register",id:"register",depth:3,charIndex:486},{text:"Configurations",id:"configurations",depth:2,charIndex:569},{text:"exclude",id:"exclude",depth:3,charIndex:599},{text:"overrides",id:"overrides",depth:3,charIndex:655},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:708},{text:"Globals",id:"globals",depth:3,charIndex:726},{text:"Modules",id:"modules",depth:3,charIndex:877},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:1336}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-polyfill",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:497},{text:"Install",id:"install",depth:3,charIndex:512},{text:"Register",id:"register",depth:3,charIndex:523},{text:"Config",id:"config",depth:2,charIndex:778},{text:"targets",id:"targets",depth:3,charIndex:799}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-vue",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:547},{text:"Install",id:"install",depth:3,charIndex:562},{text:"Register",id:"register",depth:3,charIndex:573},{text:"Options",id:"options",depth:2,charIndex:656},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:667}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-vue.mdx"},{title:"buildConfig",routePath:"/module-tools/api/config/build-config",lang:"zh",toc:[{text:"alias",id:"alias",depth:2,charIndex:141},{text:"asset",id:"asset",depth:2,charIndex:483},{text:"asset.name",id:"assetname",depth:2,charIndex:506},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:753},{text:"asset.path",id:"assetpath",depth:2,charIndex:981},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:1052},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:1159},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:1411},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:1510},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:1611},{text:"autoExtension",id:"autoextension",depth:2,charIndex:1802},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:2393},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:2670},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:2758},{text:"banner",id:"banner",depth:2,charIndex:2854},{text:"buildType",id:"buildtype",depth:2,charIndex:2984},{text:"copy",id:"copy",depth:2,charIndex:3087},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:3128},{text:"copy.options",id:"copyoptions",depth:2,charIndex:3180},{text:"define",id:"define",depth:2,charIndex:3341},{text:"dts",id:"dts",depth:2,charIndex:3802},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:3864},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:4097},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:4196},{text:"dts.only",id:"dtsonly",depth:2,charIndex:4419},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:4499},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:4718},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:4790},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:5293},{text:"externals",id:"externals",depth:2,charIndex:5501},{text:"footer",id:"footer",depth:2,charIndex:5617},{text:"format",id:"format",depth:2,charIndex:5655},{text:"format: esm",id:"format-esm",depth:3,charIndex:5780},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:5859},{text:"format: iife",id:"format-iife",depth:3,charIndex:5957},{text:"format: umd",id:"format-umd",depth:3,charIndex:6058},{text:"hooks",id:"hooks",depth:2,charIndex:6211},{text:"input",id:"input",depth:2,charIndex:6359},{text:"jsx",id:"jsx",depth:2,charIndex:6824},{text:"metafile",id:"metafile",depth:2,charIndex:7147},{text:"minify",id:"minify",depth:2,charIndex:7385},{text:"outDir",id:"outdir",depth:2,charIndex:7505},{text:"platform",id:"platform",depth:2,charIndex:7559},{text:"redirect",id:"redirect",depth:2,charIndex:7693},{text:"resolve",id:"resolve",depth:2,charIndex:7924},{text:"resolve.alias",id:"resolvealias",depth:3,charIndex:7946},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:8324},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:8641},{text:"shims",id:"shims",depth:2,charIndex:8898},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:9165},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:9607},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:9723},{text:"sourceType",id:"sourcetype",depth:2,charIndex:9810},{text:"splitting",id:"splitting",depth:2,charIndex:9968},{text:"style",id:"style",depth:2,charIndex:10081},{text:"style.less",id:"styleless",depth:2,charIndex:10102},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:10128},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:10219},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:10303},{text:"sass",id:"sass",depth:2,charIndex:10478},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:10498},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:10568},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:10663},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:10839},{text:"style.inject",id:"styleinject",depth:2,charIndex:10998},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:11494},{text:"style.modules",id:"stylemodules",depth:2,charIndex:11728},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:11907},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3,charIndex:11989},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3,charIndex:12109},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3,charIndex:12240},{text:"target",id:"target",depth:2,charIndex:12530},{text:"transformImport",id:"transformimport",depth:2,charIndex:12696},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:12892},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:13134},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:13222},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:13382}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/api/config/build-preset",lang:"zh",toc:[{text:"`npm-library`",id:"npm-library",depth:2,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:2,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:835}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/api/config/dev",lang:"zh",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:43},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:118},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4,charIndex:314},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:417}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/api/config/plugins",lang:"zh",toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2,charIndex:79},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2,charIndex:221},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:253},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3,charIndex:259},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4,charIndex:316},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3,charIndex:364}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/api/config/plugins.md"},{title:"\u6982\u89C8",routePath:"/module-tools/api/",lang:"zh",toc:[],frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1},version:"",_relativePath:"zh/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/api/plugin-api/plugin-hooks",lang:"zh",toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2,charIndex:209},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2,charIndex:276},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2,charIndex:713},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2,charIndex:1459},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/components/faq-build-exception",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/components/faq-build-other",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/components/faq-build-product",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/components/faq-storybook",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/components/publish-emo",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/components/register-esbuild-plugin",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/components/release-module-doc",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/release-module-doc.mdx"},{title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",routePath:"/module-tools/guide/advance/asset",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2,charIndex:74},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:355}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/advance/asset.mdx"},{title:"\u6784\u5EFA umd \u4EA7\u7269",routePath:"/module-tools/guide/advance/build-umd",lang:"zh",toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2,charIndex:181},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:302},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3,charIndex:556},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2,charIndex:836}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/advance/build-umd.mdx"},{title:"\u4F7F\u7528 Copy \u5DE5\u5177",routePath:"/module-tools/guide/advance/copy",lang:"zh",toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2,charIndex:72},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2,charIndex:165},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2,charIndex:826},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3,charIndex:838},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:851},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:865},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3,charIndex:879},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3,charIndex:891}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/advance/copy.md"},{title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",routePath:"/module-tools/guide/advance/external-dependency",lang:"zh",toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2,charIndex:264},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:521},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2,charIndex:652}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/advance/external-dependency.mdx"},{title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",routePath:"/module-tools/guide/advance/in-depth-about-build",lang:"zh",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2,charIndex:1281},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2,charIndex:1762},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3,charIndex:1936},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:1946},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:2048},{text:"Hook API",id:"hook-api",depth:3,charIndex:2117},{text:"load",id:"load",depth:4,charIndex:2128},{text:"transform",id:"transform",depth:4,charIndex:2236},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:2358},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2,charIndex:2500},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3,charIndex:2542},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3,charIndex:2619},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3,charIndex:3090},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3,charIndex:3208},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2,charIndex:3220},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2,charIndex:3394},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2,charIndex:3567}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/advance/in-depth-about-build.md"},{title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",routePath:"/module-tools/guide/advance/in-depth-about-dev-command",lang:"zh",toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2,charIndex:42},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2,charIndex:333}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/advance/in-depth-about-dev-command.md"},{title:"\u5F00\u59CB\u4E4B\u524D",routePath:"/module-tools/guide/basic/before-getting-started",lang:"zh",toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2,charIndex:3},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2,charIndex:188},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2,charIndex:391},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2,charIndex:818},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2,charIndex:1602},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3,charIndex:1621},{text:'"scripts"',id:"scripts",depth:3,charIndex:2042},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:2825},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2,charIndex:3139},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2,charIndex:3247}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/basic/before-getting-started.md"},{title:"CLI \u547D\u4EE4",routePath:"/module-tools/guide/basic/command-preview",lang:"zh",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/basic/command-preview.md"},{title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",routePath:"/module-tools/guide/basic/modify-output-product",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2,charIndex:3},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2,charIndex:344},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2,charIndex:664},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2,charIndex:1952}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/basic/modify-output-product.md"},{title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",routePath:"/module-tools/guide/basic/publish-your-project",lang:"zh",toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2,charIndex:231},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2,charIndex:519},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2,charIndex:728},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2,charIndex:1040}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/basic/publish-your-project.mdx"},{title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",routePath:"/module-tools/guide/basic/use-micro-generator",lang:"zh",toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2,charIndex:166},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2,charIndex:370},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2,charIndex:561},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2,charIndex:709}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/basic/use-micro-generator.md"},{title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",routePath:"/module-tools/guide/basic/use-module-doc",lang:"zh",toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2,charIndex:29},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3,charIndex:37},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3,charIndex:146},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2,charIndex:233},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3,charIndex:625},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2,charIndex:830},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2,charIndex:916},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:973},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3,charIndex:1216},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3,charIndex:1369},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2,charIndex:1461},{text:"API",id:"api",depth:3,charIndex:1505},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4,charIndex:1525},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4,charIndex:1563},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4,charIndex:2032},{text:"Overview",id:"overview",depth:3,charIndex:2092},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2,charIndex:2360},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:2368},{text:"doc",id:"doc",depth:3,charIndex:2478},{text:"entries",id:"entries",depth:3,charIndex:2493},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:2596},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:2749},{text:"previewMode",id:"previewmode",depth:3,charIndex:2818},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:2936},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:3003},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2,charIndex:3112},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2,charIndex:3184}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/use-module-doc.mdx"},{title:"\u4F7F\u7528 Storybook",routePath:"/module-tools/guide/basic/using-storybook",lang:"zh",toc:[{text:"V7 (\u63A8\u8350)",id:"v7-\u63A8\u8350",depth:2,charIndex:239},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook",depth:3,charIndex:250},{text:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",id:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",depth:3,charIndex:492},{text:"\u5F00\u542F Rspack \u6784\u5EFA",id:"\u5F00\u542F-rspack-\u6784\u5EFA",depth:3,charIndex:946},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:3,charIndex:1095},{text:"bundler",id:"bundler",depth:4,charIndex:1134},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:1222},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:3,charIndex:1356},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:1409},{text:"storybook build",id:"storybook-build",depth:4,charIndex:1444},{text:"\u914D\u7F6E\u6587\u4EF6",id:"\u914D\u7F6E\u6587\u4EF6",depth:3,charIndex:1490},{text:"\u4ECE V6 \u8FC1\u79FB\u81F3 V7",id:"\u4ECE-v6-\u8FC1\u79FB\u81F3-v7",depth:2,charIndex:1574},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:2037},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook-1",depth:3,charIndex:2178},{text:"\u914D\u7F6E Storybook",id:"\u914D\u7F6E-storybook",depth:3,charIndex:2358},{text:"\u6784\u5EFA Storybook \u4EA7\u7269",id:"\u6784\u5EFA-storybook-\u4EA7\u7269",depth:3,charIndex:2705}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/using-storybook.mdx"},{title:"\u5F00\u53D1\u7EC4\u4EF6",routePath:"/module-tools/guide/best-practices/components",lang:"zh",toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2,charIndex:40},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2,charIndex:166},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2,charIndex:227},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:335},{text:"Less",id:"less",depth:3,charIndex:587},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:680},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:784},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:832},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2,charIndex:1071},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2,charIndex:1431}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/best-practices/components.mdx"},{title:"\u4F7F\u7528 Tailwind CSS",routePath:"/module-tools/guide/best-practices/use-tailwindcss",lang:"zh",toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2,charIndex:127},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2,charIndex:585},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2,charIndex:1047},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2,charIndex:1360},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3,charIndex:1477},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3,charIndex:1660},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2,charIndex:1732},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2,charIndex:1890},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3,charIndex:1925},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:2192},{text:"Less",id:"less",depth:4,charIndex:2300},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/best-practices/use-tailwindcss.mdx"},{title:"\u901A\u7528\u7C7B\u95EE\u9898",routePath:"/module-tools/guide/faq/basic",lang:"zh",toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2,charIndex:3},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2,charIndex:103}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/basic.mdx"},{title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/build",lang:"zh",toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2,charIndex:110},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3,charIndex:118},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:1337},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2,charIndex:1559},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:1568},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4,charIndex:1614},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4,charIndex:1714},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4,charIndex:1916},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:2338},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:2595},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3,charIndex:-1},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2,charIndex:2940},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3,charIndex:2946},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3,charIndex:3184},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3,charIndex:3492}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/build.mdx"},{title:"\u5E38\u89C1\u95EE\u9898",routePath:"/module-tools/guide/faq/",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/guide/faq/index.md"},{title:"Storybook \u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/storybook",lang:"zh",toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2,charIndex:3},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2,charIndex:58},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:263},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2,charIndex:373},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2,charIndex:538},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2,charIndex:696},{text:"Tailwind CSS \u5728 Storybook \u4E2D\u4E0D\u751F\u6548",id:"tailwind-css-\u5728-storybook-\u4E2D\u4E0D\u751F\u6548",depth:2,charIndex:918}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/storybook.mdx"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/guide/intro/getting-started",lang:"zh",toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2,charIndex:3},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3,charIndex:110},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3,charIndex:402},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3,charIndex:784},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3,charIndex:1118},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2,charIndex:1175}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/intro/getting-started.mdx"},{title:"\u6B22\u8FCE\u4F7F\u7528",routePath:"/module-tools/guide/intro/welcome",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/intro/welcome.md"},{title:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",routePath:"/module-tools/guide/intro/why-module-engineering-solution",lang:"zh",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/",lang:"zh",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Lint: \u4EE3\u7801\u683C\u5F0F\u5316",details:"\u4E30\u5BCC\u573A\u666F\u7684\u5185\u7F6E ESLint \u89C4\u5219\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"zh/index.md"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/plugins/guide/getting-started",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/plugins/guide/getting-started.mdx"},{title:"\u63D2\u4EF6\u5BF9\u8C61",routePath:"/module-tools/plugins/guide/plugin-object",lang:"zh",toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2,charIndex:245},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2,charIndex:323}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/plugins/guide/plugin-object.mdx"},{title:"Setup \u51FD\u6570",routePath:"/module-tools/plugins/guide/setup-function",lang:"zh",toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2,charIndex:77},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2,charIndex:430},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2,charIndex:579}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/plugins/guide/setup-function.mdx"},{title:"\u603B\u89C8",routePath:"/module-tools/plugins/official-list/overview",lang:"zh",toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/overview.md"},{title:"Babel \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-babel",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:50},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:58},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:64},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:172}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-babel.mdx"},{title:"Banner \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-banner",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:132},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:140},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:146},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:240},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3,charIndex:246},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:267},{text:"banner",id:"banner",depth:3,charIndex:283},{text:"footer",id:"footer",depth:3,charIndex:362}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-banner.mdx"},{title:"Import \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-import",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:144},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:152},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:158},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:245},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:261},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2,charIndex:357}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-node-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:213},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:221},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:227},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:274},{text:"exclude",id:"exclude",depth:3,charIndex:290},{text:"overrides",id:"overrides",depth:3,charIndex:326},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:363},{text:"Globals",id:"globals",depth:3,charIndex:381},{text:"Modules",id:"modules",depth:3,charIndex:464},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:860}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:197},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:205},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:211},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:322},{text:"targets",id:"targets",depth:3,charIndex:338}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-vue",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:256},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:264},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:270},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:317},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:323}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-vue.mdx"}],markdown:{showLineNumbers:!1,defaultWrapCode:!1,codeHighlighter:"prism"}}},4361:function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},9580:function(e,t,n){"use strict";n.d(t,{Zo:function(){return l},ah:function(){return a}});var i=n(2363);let r=i.createContext({});function a(e){let t=i.useContext(r);return i.useMemo(()=>"function"==typeof e?e(t):{...t,...e},[t,e])}let o={};function l({components:e,children:t,disableParentContext:n}){let l;return l=n?"function"==typeof e?e({}):e||o:a(e),i.createElement(r.Provider,{value:l},t)}},33:function(e,t,n){"use strict";n.d(t,{$U:function(){return th},E9:function(){return tv},Kw:function(){return td},_f:function(){return to},bw:function(){return tr},kv:function(){return te},lm:function(){return ta},mi:function(){return ts},pJ:function(){return tx},pZ:function(){return tu},rp:function(){return tt},t6:function(){return tn},tz:function(){return tg},xM:function(){return tp},xf:function(){return tc},yc:function(){return tf},yv:function(){return ti}});var i,r,a,o,l,s,d,c,u,h="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,m=h||p||Function("return this")(),f=m.Symbol,g=Object.prototype,x=g.hasOwnProperty,v=g.toString,b=f?f.toStringTag:void 0,y=function(e){var t=x.call(e,b),n=e[b];try{e[b]=void 0;var i=!0}catch(e){}var r=v.call(e);return i&&(t?e[b]=n:delete e[b]),r},w=Object.prototype.toString,k=f?f.toStringTag:void 0,j=function(e){var t;if(null==e)return void 0===e?"[object Undefined]":"[object Null]";return k&&k in Object(e)?y(e):(t=e,w.call(t))},I=function(e){return null!=e&&"object"==typeof e},P=Array.isArray,S=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},E=function(e){return e},C=function(e){if(!S(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},_=m["__core-js_shared__"];var N=(i=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",z=Function.prototype.toString,A=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},T=/^\[object .+?Constructor\]$/,O=Object.prototype,M=Function.prototype.toString,L=O.hasOwnProperty,R=RegExp("^"+M.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$=function(e){var t;return!!S(e)&&(t=e,!N||!(N in t))&&(C(e)?R:T).test(A(e))},B=function(e,t){var n,i,r=(n=e,i=t,null==n?void 0:n[i]);return $(r)?r:void 0},D=Object.create,H=function(){function e(){}return function(t){if(!S(t))return{};if(D)return D(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),F=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},W=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n0){if(++a>=800)return arguments[0]}else a=0;return r.apply(void 0,arguments)}),G=/^(?:0|[1-9]\d*)$/,Z=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&G.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ei=function(e){return null!=e&&en(e.length)&&!C(e)},er=function(e,t,n){if(!S(n))return!1;var i=typeof t;return("number"==i?!!(ei(n)&&Z(t,n.length)):"string"==i&&t in n)&&K(n[t],e)},ea=Object.prototype,eo=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ea)},el=function(e,t){for(var n=-1,i=Array(e);++n-1},eR.prototype.set=function(e,t){var n=this.__data__,i=eM(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var e$=B(m,"Map"),eB=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eD=function(e,t){var n=e.__data__;return eB(t)?n["string"==typeof t?"string":"hash"]:n.map};function eH(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t1?t[i-1]:void 0,a=i>2?t[2]:void 0;for(r=u.length>3&&"function"==typeof r?(i--,r):void 0,a&&er(t[0],t[1],a)&&(r=i<3?void 0:r,i=1),e=Object(e);++n!0,tr=e=>e.replace(e9,"").replace(e8,"");function ta(e){return e.replace(/#.*$/,"")}var to=()=>!0;function tl(e){return"/"===e.charAt(0)||tc(e)?e:`/${e}`}function ts(e){return"/"===e.charAt(e.length-1)?e:`${e}/`}function td(e){var t;return"/"===(t=tl(function(e){let t=e.replace(/\\/g,"/"),n=t.startsWith("/"),i=t.split("/"),r=[];for(let e of i)"."===e||""===e||(".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():n&&r.push(".."):r.push(e));let a=r.join("/");return n&&(a=`/${a}`),a}(e))).charAt(t.length-1)?t.slice(0,-1):t}function tc(e=""){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")}function tu(e=""){return/^\s*data:/i.test(e)}function th(e,t,n,i="",r=!1,a=!1){let o=tv(e,i);(!o||a)&&(o=r?"/index":"/index.html"),o.endsWith("/")&&(o+=r?"/index":"/index.html");let l="",s="",d="",c=o.split("/").filter(Boolean);return n.current&&n.current!==n.default&&(l=c.shift()||""),t.target!==t.default?(s=t.target,t.current!==t.default&&c.shift()):c.shift(),d=c.join("/")||"",(l||s)&&!d&&(d=r?"index":"index.html"),tx(tl([l,s,d].filter(Boolean).join("/")),i)}function tp(e,t,n="",i=!1,r=!1){let a=tv(e,n);(!a||r)&&(a=i?"/index":"/index.html");let o="",l=a.split("/").filter(Boolean);t.target!==t.default?(o=t.target,t.current!==t.default&&l.shift()):l.shift();let s=l.join("/")||"";return o&&!s&&(s=i?"index":"index.html"),tx(tl([o,s].filter(Boolean).join("/")),n)}var tm=e=>{let[t,n=""]=e.split("#");return{url:t,hash:n}};function tf(e,t=!1){if(!e)return"/";if(tc(e))return e;let{url:n,hash:i}=tm(decodeURIComponent(e));return!t&&!n.endsWith(".html")&&(n.endsWith("/")?n+="index.html":n+=".html"),t&&n.endsWith("/")&&(n+="index"),t&&n.endsWith(".html")&&(n=n.replace(/\.html$/,"")),tl(i?`${n}#${i}`:n)}function tg(e,t=""){return tl(e).replace(td(t),"")}function tx(e="/",t=""){let n=tl(e),i=td(t);return n.startsWith(i)?n:`${i}${n}`}function tv(e,t){return tl(e).replace(RegExp(`^${td(t)}`),"")}},1411:function(e,t,n){"use strict";n.d(t,{YE:()=>ro,WG:()=>iv,ZB:()=>rs,Rg:()=>rc,KO:()=>iu,OK:()=>iQ,Ar:()=>nj,rU:()=>is,JL:()=>iM,Qn:()=>ng,RY:()=>nw,mi:()=>n5,BZ:()=>n8,xN:()=>np,Ct:()=>n1,zx:()=>n3,xK:()=>n9,mQ:()=>iJ,Vp:()=>ru,of:()=>rp,UQ:()=>tF,AV:()=>t8,tx:()=>tM,ls:()=>nr,ZP:()=>rm,TJ:()=>nX,zh:()=>na,s2:()=>no,H_:()=>nh,NG:()=>nl,VA:()=>nu,eF:()=>tH,cY:()=>tW,CU:()=>tR,CF:()=>t$,YS:()=>t7,Vl:()=>tB,M4:()=>tT,eE:()=>tq,WS:()=>tL,xB:()=>ir,Os:()=>nI,O9:()=>io,qx:()=>tA,g2:()=>iR,SU:()=>iW,Qe:()=>iU,y2:()=>t5,pU:()=>iG,ol:()=>i5,EG:()=>i4});var i,r,a,o,l,s,d,c,u,h,p,m,f,g,x,v,b,y,w,k,j,I,P,S,E,C={};n.r(C),n.d(C,{onSearch:()=>td}),n("909");let _=n("835"),N=n("7833"),z=n("9980");n("5311");let A=n("288"),T=n("2363"),O=n("8319"),M=n("1207"),L=n("6780"),{routes:R}=n(6118),$=(0,T.memo)(function(e){let t=e.el;return L.Z?.themeConfig?.enableContentAnimation&&(t=(0,_.n_)(e.el)),t},(e,t)=>e.el===t.el),B=({fallback:e=(0,z.jsx)(z.Fragment,{})})=>{let{pathname:t}=(0,O.TH)(),n=(0,M.fp)(R,(0,N.Tm)(t));if(!n)return(0,z.jsx)("div",{});let i=n[0].route.element;return(0,z.jsx)(T.Suspense,{fallback:e,children:(0,z.jsx)($,{el:i})})},D=n("9580");function H(e){let{children:t}=e,[n,i]=(0,T.useState)(!1);return((0,T.useEffect)(()=>{i(!0)},[]),n)?(0,z.jsx)(z.Fragment,{children:t}):null}let F=n("33"),W=n("5187"),q=n("5653"),U={"###en":"08fa5107","###zh":"62c236ba"},V=n("3371"),G=n("3393"),Z=/\s?|(]*>|]*>|]+>)+/i,Y=RegExp(G.map(e=>`<${e}\\b[^>]*>`).join("|"),"i"),K=n("4520");var J=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"})}),Q=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M22 16 12 26l-1.4-1.4 8.6-8.6-8.6-8.6L12 6z"})});function X(){return(X=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[i]=e[i]}return n}function et(e,t){return(et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function en(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,et(e,t)}function ei(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}let er=n("1850"),ea={disabled:!1},eo=T.createContext(null);var el=function(e){return e.scrollTop},es="unmounted",ed="exited",ec="entering",eu="entered",eh="exiting",ep=function(e){function t(t,n){i=e.call(this,t,n)||this;var i,r,a=n&&!n.isMounting?t.enter:t.appear;return i.appearStatus=null,t.in?a?(r=ed,i.appearStatus=ec):r=eu:r=t.unmountOnExit||t.mountOnEnter?es:ed,i.state={status:r},i.nextCallback=null,i}en(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===es?{status:ed}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==ec&&n!==eu&&(t=ec):(n===ec||n===eu)&&(t=eh)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,i=this.props.timeout;return e=t=n=i,null!=i&&"number"!=typeof i&&(e=i.exit,t=i.enter,n=void 0!==i.appear?i.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t){if(this.cancelNextCallback(),t===ec){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:er.findDOMNode(this);n&&el(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===ed&&this.setState({status:es})},n.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,r=this.props.nodeRef?[i]:[er.findDOMNode(this),i],a=r[0],o=r[1],l=this.getTimeouts(),s=i?l.appear:l.enter;if(!e&&!n||ea.disabled){this.safeSetState({status:eu},function(){t.props.onEntered(a)});return}this.props.onEnter(a,o),this.safeSetState({status:ec},function(){t.props.onEntering(a,o),t.onTransitionEnd(s,function(){t.safeSetState({status:eu},function(){t.props.onEntered(a,o)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:er.findDOMNode(this);if(!t||ea.disabled){this.safeSetState({status:ed},function(){e.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:eh},function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:ed},function(){e.props.onExited(i)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(i){n&&(n=!1,t.nextCallback=null,e(i))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:er.findDOMNode(this),i=null==e&&!this.props.addEndListener;if(!n||i){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var r=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=r[0],o=r[1];this.props.addEndListener(a,o)}null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===es)return null;var t=this.props,n=t.children,i=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,ee(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return T.createElement(eo.Provider,{value:null},"function"==typeof n?n(e,i):T.cloneElement(T.Children.only(n),i))},t}(T.Component);function em(){}ep.contextType=eo,ep.propTypes={},ep.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:em,onEntering:em,onEntered:em,onExit:em,onExiting:em,onExited:em},ep.UNMOUNTED=es,ep.EXITED=ed,ep.ENTERING=ec,ep.ENTERED=eu,ep.EXITING=eh;var ef=function(e,t){return e&&t&&t.split(" ").forEach(function(t){var n,i;return n=e,i=t,void(n.classList?n.classList.remove(i):"string"==typeof n.className?n.className=ei(n.className,i):n.setAttribute("class",ei(n.className&&n.className.baseVal||"",i)))})},eg=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 7H3V5h13v2M3 19h13v-2H3v2m19-7-4-3v2H3v2h15v2l4-3Z"})}),ev=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"#22a041",d:"M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"})});let eb={javascript:["js"],markdown:["md"],tsx:["mdx"],typescript:["ts"]},ey={bash:n(4251).default,css:n(273).default,diff:n(4580).default,javascript:n(6586).default,json:n(8960).default,less:n(1107).default,markdown:n(9159).default,sass:n(6929).default,scss:n(8831).default,tsx:n(9549).default,typescript:n(6397).default};function ew(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,n,i=e.join(".");if(!eS[i]){;eS[i]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0}return eS[i]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return eP(eP({},e),n[t])},t)}(o.className,Object.assign({},o.style,void 0===i?{}:i),n)})}else p=eP(eP({},o),{},{className:o.className.join(" ")});var v=m(t.children);return T.createElement(s,X({key:a},p),v)}}var e_=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function eN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ez(e){for(var t=1;t=0||({}).propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,e_);O=O||i;var L=m?T.createElement(eT,{containerStyle:b,codeStyle:c.style||{},numberStyle:w,startingLineNumber:v,codeString:A}):null,R=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},$=e$(O)?"hljs":"prismjs",B=h?Object.assign({},M,{style:Object.assign({},R,s)}):Object.assign({},M,{className:M.className?"".concat($," ").concat(M.className):$,style:Object.assign({},s)});if(I?c.style=ez(ez({},c.style),{},{whiteSpace:"pre-wrap"}):c.style=ez(ez({},c.style),{},{whiteSpace:"pre"}),!O)return T.createElement(C,B,L,T.createElement(N,c,A));(void 0===k&&S||I)&&(k=!0),S=S||eR;var D=[{type:"text",value:A}],H=function(e){var t=e.astGenerator,n=e.language,i=e.code,r=e.defaultCodeValue;if(e$(t)){var a,o,l=(a=t,o=n,-1!==a.listLanguages().indexOf(o));return"text"===n?{value:r,language:"text"}:l?t.highlight(n,i):t.highlightAuto(i)}try{return n&&"text"!==n?{value:t.highlight(i,n)}:{value:r}}catch(e){return{value:r}}}({astGenerator:O,language:t,code:A,defaultCodeValue:D});null===H.language&&(H.value=D);var F=H.value.length+v,W=function(e,t,n,i,r,a,o,l,s){var d,c=function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r2&&void 0!==arguments[2]?arguments[2]:[];return t||d.length>0?function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return eL({children:e,lineNumber:t,lineNumberStyle:l,largestLineNumber:o,showInlineLineNumbers:r,lineProps:n,className:a,showLineNumbers:i,wrapLongLines:s})}(e,a,d):function(e,t){if(i&&t&&r){var n=eM(l,t,o);e.unshift(eO(t,n))}return e}(e,a)}for(;p(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 30 30",...e,children:[(0,z.jsx)("path",{fill:"currentColor",d:"M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"})]}),eq=e=>(0,z.jsx)("svg",{width:32,height:32,viewBox:"0 0 30 30",...e,children:(0,z.jsx)("path",{fill:"#49cd37",d:"m13 24-9-9 1.414-1.414L13 21.171 26.586 7.586 28 9 13 24z"})});let eU=n("7841"),eV=n("6118");var eG=e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",...e,children:[(0,z.jsx)("circle",{cx:8,cy:16,r:2,fill:"currentColor"}),(0,z.jsx)("circle",{cx:16,cy:16,r:2,fill:"currentColor"}),(0,z.jsx)("circle",{cx:24,cy:16,r:2,fill:"currentColor"})]}),eZ=!1;if("undefined"!=typeof window){var eY={get passive(){eZ=!0;return}};window.addEventListener("testPassive",null,eY),window.removeEventListener("testPassive",null,eY)}var eK="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),eJ=[],eQ=!1,eX=-1,e0=void 0,e1=void 0,e2=void 0,e3=function(e){return eJ.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))||!1})},e4=function(e){var t=e||window.event;return!!e3(t.target)||!!(t.touches.length>1)||(t.preventDefault&&t.preventDefault(),!1)},e5=function(e){if(void 0===e2){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);e2=document.body.style.paddingRight,document.body.style.paddingRight=i+n+"px"}}void 0===e0&&(e0=document.body.style.overflow,document.body.style.overflow="hidden")},e6=function(){void 0!==e2&&(document.body.style.paddingRight=e2,e2=void 0),void 0!==e0&&(document.body.style.overflow=e0,e0=void 0)},e7=function(){if(void 0!==e1){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=e1.position,document.body.style.top=e1.top,document.body.style.left=e1.left,window.scrollTo(t,e),e1=void 0}},e8=function(e,t){var n,i=e.targetTouches[0].clientY-eX;if(e3(e.target))return!1;if(t&&0===t.scrollTop&&i>0)return e4(e);return(n=t)&&n.scrollHeight-n.scrollTop<=n.clientHeight&&i<0?e4(e):(e.stopPropagation(),!0)},e9=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!eJ.some(function(t){return t.targetElement===e}))eJ=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t=i&&(document.body.style.top=-(t+e))})},300)}}):e5(t),eK&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(eX=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&e8(t,e)},!eQ&&(document.addEventListener("touchmove",e4,eZ?{passive:!1}:void 0),eQ=!0))},te=function(){eK&&(eJ.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),eQ&&(document.removeEventListener("touchmove",e4,eZ?{passive:!1}:void 0),eQ=!1),eX=-1),eK?e7():e6(),eJ=[]},tt=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{d:"M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"})}),tn=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{d:"M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"})}),ti=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})}),tr=e=>(0,z.jsx)("svg",{width:18,height:18,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6 2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z"})}),ta=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})}),to=e=>(0,z.jsx)("svg",{width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"var(--rp-c-gray)",d:"m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z"})});let tl=n("4154"),ts=n("1716"),td=()=>{};var tc=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M24 9.4 22.6 8 16 14.6 9.4 8 8 9.4l6.6 6.6L8 22.6 9.4 24l6.6-6.6 6.6 6.6 1.4-1.4-6.6-6.6L24 9.4z"})}),tu=e=>(0,z.jsx)("svg",{width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsxs)("g",{fill:"none",stroke:"var(--rp-c-brand)",strokeLinecap:"round",strokeWidth:2,children:[(0,z.jsx)("path",{strokeDasharray:60,strokeDashoffset:60,strokeOpacity:.3,d:"M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",children:(0,z.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"1.3s",values:"60;0"})}),(0,z.jsxs)("path",{strokeDasharray:15,strokeDashoffset:15,d:"M12 3a9 9 0 0 1 9 9",children:[(0,z.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),(0,z.jsx)("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})]})]})}),th=e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,fill:"none",viewBox:"0 0 48 48",...e,children:[(0,z.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M24 5v6m7 1 4-4m-18 4-4-4m27 33H8a2 2 0 0 1-2-2v-8.46a2 2 0 0 1 .272-1.007l6.15-10.54A2 2 0 0 1 14.148 18H33.85a2 2 0 0 1 1.728.992l6.149 10.541A2 2 0 0 1 42 30.541V39a2 2 0 0 1-2 2Z"}),(0,z.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M41.5 30H28s-1 3-4 3-4-3-4-3H6.5"})]}),tp=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M13.414 17.586 18 22.172V8H8V6h10a2.002 2.002 0 0 1 2 2v14.172l4.586-4.586L26 19l-7 7-7-7Z"})}),tm=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",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"})}),tf=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"m21.94 13.11-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91-6.17-7.91m8.73 7.92 2.47-7.59.1-.33h3.61l-5.59 7.16m4.1-13.67 1.81 5.56h-3.62m-1.3.95-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94 7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43 5.82 7.45m11.38-4.73-6.51 4.73.02-.03 5.79-7.42.79 2.43c.04.1 0 .22-.09.29"})}),tg=Object.defineProperty,tx=Object.defineProperties,tv=Object.getOwnPropertyDescriptors,tb=Object.getOwnPropertySymbols,ty=Object.prototype.hasOwnProperty,tw=Object.prototype.propertyIsEnumerable,tk=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tj=(e,t)=>{for(var n in t||(t={}))ty.call(t,n)&&tk(e,n,t[n]);if(tb)for(var n of tb(t))tw.call(t,n)&&tk(e,n,t[n]);return e},tI=(e,t)=>tx(e,tv(t)),tP=(e,t)=>{var n={};for(var i in e)ty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&tb)for(var i of tb(e))0>t.indexOf(i)&&tw.call(e,i)&&(n[i]=e[i]);return n},tS=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tE=(e,t,n)=>(tS(e,t,"read from private field"),n?n.call(e):t.get(e)),tC=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},t_=(e,t,n,i)=>(tS(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),tN=(e,t,n)=>(tS(e,t,"access private method"),n),tz=(e,t,n)=>new Promise((i,r)=>{var a=e=>{try{l(n.next(e))}catch(e){r(e)}},o=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=e=>e.done?i(e.value):Promise.resolve(e.value).then(a,o);l((n=n.apply(e,t)).next())});function tA(){let{siteData:e,page:t}=(0,_.Vi)(),n=e.lang,i=e.multiVersion.default;if(n&&"undefined"!=typeof window&&location.pathname.includes(`/${n}/`)){let e=location.pathname.replace(`/${n}/`,"/");return window.location.replace(e),(0,z.jsx)(z.Fragment,{})}let r="/";return i&&t.version!==i&&(r+=`${t.version}/`),n&&t.lang!==n&&(r+=`${t.lang}/`),(0,z.jsxs)("div",{className:"m-auto mt-50 p-16 sm:p-8 sm:pt-24 sm:pb-40 text-center flex-center flex-col",children:[(0,z.jsx)("p",{className:"text-6xl font-semibold",children:"404"}),(0,z.jsx)("h1",{className:"leading-5 pt-3 text-xl font-bold",children:"PAGE NOT FOUND"}),(0,z.jsx)("div",{style:{height:"1px"},className:"mt-6 mx-auto mb-4.5 w-16 bg-gray-light-1"}),(0,z.jsx)("div",{className:"pt-5",children:(0,z.jsx)("a",{className:"py-2 px-4 rounded-2xl inline-block border-solid border-brand text-brand font-medium hover:border-brand-dark hover:text-brand-dark transition-colors duration-300",href:(0,N.pJ)(r),"aria-label":"go to home",children:"Take me home"})})]})}function tT(){var e,t,n;let i=(0,_.Vi)(),{page:{lang:r}}=i,a=null!=(t=null==(e=null==i?void 0:i.siteData)?void 0:e.themeConfig)?t:{},o=null!=(n=i.siteData.lang)?n:"",l=null==a?void 0:a.locales;return l&&0!==l.length?tI(tj({},l.find(e=>e.lang===r)),{langRoutePrefix:r===o?"/":r}):{nav:a.nav,sidebar:a.sidebar,prevPageText:a.prevPageText,nextPageText:a.nextPageText,sourceCodeText:a.sourceCodeText,searchPlaceholderText:a.searchPlaceholderText,searchNoResultsText:a.searchNoResultsText,searchSuggestedQueryText:a.searchSuggestedQueryText}}var tO=(e,t)=>{let n;for(let i of Object.keys(e)){if(n&&n!==i)continue;if((0,N.pV)((0,N.pJ)(i),t))return{group:"Documentation",items:e[i]};let r=e[i].find(r=>{let a=r=>{if(!t.startsWith((0,N.pJ)(i))){for(let r of Object.keys(e))if(r!==i&&t.startsWith((0,F.mi)((0,N.pJ)(r))))return n=r,!1}let o=()=>"link"in r&&(0,N.pV)((0,N.pJ)(r.link),t);if("items"in r)return!!o()||r.items.some(e=>a(e));return o()};return a(r)});if(r){let t=e[i];return{group:"text"in r&&r.text||"",items:t}}}return{group:"Documentation",items:[]}};function tM(){var e;let t=tT(),n=null!=(e=t.sidebar)?e:{},{pathname:i}=(0,O.TH)(),r=decodeURIComponent(i),[a,o]=(0,T.useState)(tO(n,r));return(0,T.useEffect)(()=>{o(tO(n,r))},[r,t.lang]),a}function tL(){let{pathname:e}=(0,O.TH)(),{items:t}=tM(),n=[],i=e=>{"items"in e?(e.link&&n.push({text:e.text,link:e.link}),e.items.forEach(e=>{"dividerType"in e||i(e)})):n.push(e)};t.forEach(e=>!("dividerType"in e)&&i(e));let r=n.findIndex(t=>(0,N.pV)((0,N.pJ)(t.link),e)),a=n[r-1]||null;return{prevPage:a,nextPage:n[r+1]||null}}function tR(){var e,t,n;let{siteData:i,page:r}=(0,_.Vi)(),a=null!=(n=null!=(t=tT().editLink)?t:null==(e=i.themeConfig)?void 0:e.editLink)?n:{};if(!a.docRepoBaseUrl||!a.text)return null;let{docRepoBaseUrl:o}=a;!o.endsWith("/")&&(o+="/");let l=r._relativePath.replace(/\\/g,"/"),s=`${o}${l}`;return{text:a.text,link:s}}function t$(){var e;let{siteData:{themeConfig:t},page:{frontmatter:n={}}}=(0,_.Vi)(),i=(null==(e=null==n?void 0:n.navbar)||e)&&(null==t?void 0:t.hideNavbar)!=="always",[r,a]=(0,T.useState)(i);return[r,a]}function tB(){var e;let{siteData:{themeConfig:t}}=(0,_.Vi)(),n=null!=(e=t.hideNavbar)?e:"never",[i,r]=(0,T.useState)(!1),{pathname:a}=(0,O.TH)(),o=(0,T.useRef)(0);return"never"!==n&&("always"===n||((0,T.useEffect)(()=>{r(!1);let e=(0,W.Z)(()=>{let{scrollTop:e}=document.documentElement;if(e!==o.current)r(o.current>0&&e-o.current>0),o.current=e<=0?0:e},200);return window.addEventListener("mousewheel",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousewheel",e),window.removeEventListener("touchmove",e)}},[a]),i))}function tD(e,t=72){let n=Number.parseInt(window.getComputedStyle(e).paddingTop,10);return Math.round(window.scrollY+e.getBoundingClientRect().top-t-n)}function tH(e,t,n=72){window.scrollTo(tj({left:0,top:tD(e,n)},t?{behavior:"smooth"}:{}))}function tF(){let e=document.getElementById("aside-container"),t=Array.from(document.querySelectorAll(".rspress-doc .header-anchor")).filter(e=>{var t;return(null==(t=e.parentElement)?void 0:t.tagName)!=="H1"});if(!e||!t.length)return;let n=null;if(!Array.from((null==e?void 0:e.getElementsByTagName("a"))||[]).map(e=>decodeURIComponent(e.hash)).length)return;let i=(t,i)=>{if(t[i]){let r=t[i].getAttribute("href"),a=null==e?void 0:e.querySelector(`a[href="#${null==r?void 0:r.slice(1)}"] > span`);a&&(n&&n.classList.remove("aside-active"),(n=a).classList.add("aside-active"))}},r=()=>{if(document.documentElement.scrollTop+window.innerHeight>=document.documentElement.scrollHeight)i(t,t.length-1);else for(let e=0;e=o&&a{n&&n.classList.remove("aside-active"),window.removeEventListener("scroll",a)}}function tW(){if(!!(0,F._f)())window.addEventListener("click",e=>{let t=e.target.closest("a");if(t){let{origin:n,hash:i,target:r,pathname:a,search:o}=t,l=window.location;i&&"_blank"!==r&&n===l.origin&&(a===l.pathname&&o===l.search&&i&&t.classList.contains("header-anchor")?(e.preventDefault(),history.pushState(null,"",i),!function(e,t,n=!1){let i=null;try{i=e.classList.contains("header-anchor")?e:document.getElementById(decodeURIComponent(t.slice(1)))}catch(e){console.warn(e)}i&&tH(i,n)}(t,i,!0),window.dispatchEvent(new Event("hashchange"))):window.addEventListener("RspressReloadContent",()=>{location.hash.length>1&&tH(document.getElementById(location.hash.slice(1)),!1)}))}},{capture:!0}),window.addEventListener("hashchange",e=>{e.preventDefault()})}function tq(){let e=(0,_.Jr)(),t=(0,_.aw)(),n=(0,_.Vi)(),i=n.siteData.lang,r=n.siteData.multiVersion.default;return{normalizeLinkHref:n=>{let a=n;if((i||r)&&!(0,F.xf)(a)&&!a.startsWith("#")){let n=(a=(0,N.E9)(a)).split("/").filter(Boolean),o="",l="",s="";return r&&(t!==r?(o=t,n[0]===t&&n.shift()):n[0]===r&&n.shift()),i&&(e!==i?(l=e,n[0]===e&&n.shift()):n[0]===i&&n.shift()),s=n.join("/"),(0,N.AP)((0,N.pJ)([o,l,s].filter(Boolean).join("/")))}return a}}}var tU="default",tV=/[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]/u,tG=/[\u0400-\u04FF]/u;function tZ(e){let t=e.toString().toLowerCase().normalize("NFD"),n=t.replace(/[\u0300-\u036f]/g,"");return tG.test(String(e))?t.normalize("NFC"):tV.test(String(e))?n.normalize("NFC"):n}function tY(e){return e.replace(/https?:\/\/[^/]+/,"")}function tK(e){return e.charCodeAt(0)>255?3:1}var tJ=e=>e.map(e=>"string"==typeof e?{value:e,label:e}:e);function tQ(e,t){let n=0,i=0;for(let r=0;r=t);r++){;i+=tK(e.charAt(r)),n++}return n}function tX(e){let t=0;for(let n=0;ntI(tj({},e),{normalizedContent:tZ(e.content),headers:e.toc.map(e=>tZ(e.text)).join(" "),normalizedTitle:tZ(e.title)})),a={tokenize:"full",async:!0,doc:{id:"routePath",field:["normalizedTitle","headers","normalizedContent"]},cache:100,split:/\W+/};t_(this,o,q.create(a)),t_(this,l,q.create(tI(tj({},a),{tokenize:e=>t2(e,t0)}))),t_(this,s,q.create(tI(tj({},a),{tokenize:e=>t2(e,t1)}))),tE(this,o).add(r),tE(this,l).add(r),tE(this,s).add(r)})}search(e){return tz(this,null,function*(){var t,n;let{keyword:i,limit:r}=e,a={query:i,limit:r,field:["normalizedTitle","headers","normalizedContent"]},d=(yield Promise.all([null==(t=tE(this,o))?void 0:t.search(a),null==(n=tE(this,l))?void 0:n.search(a),tE(this,s).search(a)])).flat(2).filter(Boolean);return[{index:tU,hits:Array.from(new Set(d.map(e=>e.id))).map(e=>d.find(t=>t.id===e))}]})}};o=new WeakMap,l=new WeakMap,s=new WeakMap,d=new WeakSet,c=function(e,t){return tz(this,null,function*(){let n=`${t}###${e}`,i=t?`.${t.replace(".","_")}`:"",r=e?`.${e}`:"";return(yield fetch(`/module-tools/static/${F.t6}${i}${r}.${U[n]}.json`)).json()})};var t4=class{constructor(){tC(this,u,void 0)}init(e){return tz(this,null,function*(){t_(this,u,e)})}search(e){return tz(this,null,function*(){let{apiUrl:t,searchIndexes:n}=tE(this,u),{keyword:i,limit:r}=e,a=Object.entries({keyword:i,limit:r.toString(),searchIndexes:(null==n?void 0:n.map(e=>"string"==typeof e?e:e.value).join(","))||"",lang:tE(this,u).currentLang}).map(e=>e.map(encodeURIComponent).join("=")).join("&");try{return(yield fetch(`${t}?${a}`)).json()}catch(e){return console.error(e),[]}})}};u=new WeakMap;var t5=((a=t5||{}).Default="default",a.Custom="custom",a),t6=class{constructor(e){if(tC(this,f),tC(this,x),tC(this,b),tC(this,w),tC(this,j),tC(this,P),tC(this,h,void 0),tC(this,p,tU),tC(this,m,void 0),t_(this,h,e),t_(this,p,e.indexName),"remote"===e.mode)t_(this,m,new t4);else t_(this,m,new t3)}init(){return tz(this,null,function*(){var e;yield null==(e=tE(this,m))?void 0:e.init(tE(this,h))})}match(e,t=7){return tz(this,null,function*(){var n;let i=yield null==(n=tE(this,m))?void 0:n.search({keyword:e,limit:t}),r=tZ(e),a=(null==i?void 0:i.find(e=>tN(this,P,S).call(this,e.index)))||{index:tU,renderType:"default",hits:[]};return[{group:tE(this,p),renderType:"default",result:tN(this,f,g).call(this,r,a)},...((null==i?void 0:i.filter(e=>!tN(this,P,S).call(this,e.index)))||[]).map(e=>({group:e.index,renderType:"default",result:tN(this,f,g).call(this,r,e)}))]})}};function t7(){var e;let{siteData:t,page:n}=(0,_.Vi)(),[i,r]=(0,T.useState)(!1),{sidebar:a}=tT(),o=e=>tO(a,e).group,l=(0,T.useRef)(null);return(0,T.useEffect)(()=>{!function(){tz(this,null,function*(){if(!i){let e=new t6(tI(tj({},t.search),{mode:"local",currentLang:n.lang,currentVersion:n.version,extractGroupName:o}));l.current=e,yield e.init(),r(!0)}})}()},[]),{initialized:i,search:null==(e=l.current)?void 0:e.match.bind(l.current)}}function t8(){let{siteData:e,page:t}=(0,_.Vi)(),n=e.lang||"",i=Object.values(e.themeConfig.locales||{}).map(e=>e.lang)||[],r=t.lang;(0,T.useEffect)(()=>{var t;let a;if("auto"!==(null!=(t=e.themeConfig.localeRedirect)?t:"auto")||!n)return;let{pathname:o,search:l}=window.location,s=(0,N.E9)(o),d="rspress-visited";if(localStorage.getItem(d))return;localStorage.setItem(d,"1");let c=window.navigator.language.split("-")[0];if(!!i.includes(c)&&c!==r)(a=c===n?o.replace(`/${r}`,""):r===n?(0,N.pJ)(`/${c}${s}`):o.replace(`/${r}`,`/${c}`))&&window.location.replace(a+l)},[])}h=new WeakMap,p=new WeakMap,m=new WeakMap,f=new WeakSet,g=function(e,t){let n=[];return null==t||t.hits.forEach(t=>{if(tN(this,x,v).call(this,t,e,n),!tN(this,b,y).call(this,t,e,n))tN(this,w,k).call(this,t,e,n)}),n},x=new WeakSet,v=function(e,t,n){let{title:i=""}=e,r=tZ(i);return!!r.includes(t)&&(n.push({type:"title",title:i,header:i,link:`${e.domain}${(0,N.AP)(e.routePath)}`,query:t,highlightInfoList:[{start:r.indexOf(t),length:tX(t)}],group:tE(this,h).extractGroupName(e.routePath)}),!0)},b=new WeakSet,y=function(e,t,n){let{toc:i=[],domain:r="",title:a=""}=e;for(let[o,l]of i.entries())if(tZ(l.text).includes(t)){let s=(function(e,t){let n=e[t],i=t,r=[n];for(;n&&n.depth>2;){let t=!1;for(let a=i-1;a>=0;a--){let o=e[a];if(o.depth>1&&o.depth===n.depth-1){n=o,i=a,r.unshift(n),t=!0;break}}if(!t)break}return r})(i,o).map(e=>e.text).join(" > "),d=tZ(s).indexOf(t),c=`${a} > `;return n.push({type:"header",title:e.title,header:`${c}${s}`,highlightInfoList:[{start:d+c.length,length:tX(t)}],link:`${r}${(0,N.AP)(e.routePath)}#${l.id}`,query:t,group:tE(this,h).extractGroupName(e.routePath)}),!0}return!1},w=new WeakSet,k=function(e,t,n){var i,r,a;let{content:o,toc:l,domain:s}=e;if(!o.length)return;let d=tZ(o),c=d.indexOf(t),u=l.map(e=>e.charIndex),p=e=>l[u.findIndex((t,n)=>{if(!(n=e)return!0}return!1})];if(-1===c){let a=null==(i=e._matchesPosition)?void 0:i.content;if(!(null==a?void 0:a.length))return;let l=e._matchesPosition.content[0].start,d=p(l),c=tQ(o,l),u=tQ(o,l+100),m=o.slice(c,u),f=e._matchesPosition.content.filter(e=>e.start>=l&&e.start+e.length<=l+100).map(e=>({start:tQ(o,e.start)-c+3,length:e.length}));n.push({type:"content",title:e.title,header:null!=(r=null==d?void 0:d.text)?r:e.title,link:`${s}${(0,N.AP)(e.routePath)}${d?`#${d.id}`:""}`,query:t,highlightInfoList:f,group:tE(this,h).extractGroupName(e.routePath),statement:`...${m}...`});return}for(;-1!==c;){let i=p(c),r=o.slice(0,c).lastIndexOf("\n");r=-1===r?0:r;let l=o.indexOf("\n\n",c+t.length),u=o.slice(r,l);u.length>100&&(u=tN(this,j,I).call(this,u,t));let m=tZ(u).indexOf(t),f=[{start:m,length:tX(t)}];n.push({type:"content",title:e.title,header:null!=(a=null==i?void 0:i.text)?a:e.title,statement:u,highlightInfoList:f,link:`${s}${(0,N.AP)(e.routePath)}${i?`#${i.id}`:""}`,query:t,group:tE(this,h).extractGroupName(e.routePath)}),c=d.indexOf(t,c+u.length-m)}},j=new WeakSet,I=function(e,t){let n=tZ(e).indexOf(tZ(t)),i=Math.floor((100-t.length)/2),r=e.slice(0,n);r.length>i&&(r=`...${e.slice(n-i+3,n)}`);let a=e.slice(n+t.length);return a.length>i&&(a=`${e.slice(n+t.length,n+i-3)}...`),r+t+a},P=new WeakSet,S=function(e){return e===tE(this,p)||e===tU};var t9=e=>{let t=(0,T.useRef)(e);return t.current=e,(0,T.useRef)((...e)=>t.current(...e)).current},ne=e=>{let[t,n]=(0,T.useState)(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return(0,T.useEffect)(()=>{let t=window.matchMedia(e),i=e=>n(e.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[e]),t},nt=(e,t=null)=>{let[n,i]=(0,T.useState)(()=>{var n;return"undefined"==typeof window?t:null!=(n=localStorage.getItem(e))?n:t}),r=(0,T.useCallback)(t=>{i(n=>{let i="function"==typeof t?t(n):t;return null==i?localStorage.removeItem(e):localStorage.setItem(e,i),i})},[e]);return(0,T.useEffect)(()=>{let n=n=>{var r;n.key===e&&i(null!=(r=localStorage.getItem(e))?r:t)};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}},[e,t]),[n,r]},nn=e=>["light","dark","auto"].includes(e)?e:"auto",ni=!1===L.Z.themeConfig.darkMode,nr=()=>{let e=ne("(prefers-color-scheme: dark)"),[t,n]=nt(F.rp),i=t9(()=>{if(ni)return"light";let n=nn(t);return"auto"===n?e?"dark":"light":n}),[r,a]=(0,T.useState)(()=>{var e;if("undefined"==typeof window)return"light";let t=null!=(e=window.RSPRESS_THEME)?e:window.MODERN_THEME;return t?"dark"===t?"dark":"light":i()}),o=(0,T.useCallback)((e,t=e)=>{if(!ni)a(e),n(t),s(!0)},[]);(0,T.useEffect)(()=>{document.documentElement.classList.toggle("dark","dark"===r),document.documentElement.style.colorScheme=r},[r]);let[l,s]=(0,T.useState)(!0);return(0,T.useEffect)(()=>{s(!1)},[l]),(0,T.useEffect)(()=>{if(!l)o(i(),nn(t))},[t]),(0,T.useEffect)(()=>{if(!l)o(e?"dark":"light","auto")},[e]),[r,o]};function na(e,t,n=!1){return!!t&&(n?(0,N.pV)(e,t):(0,N.pV)(e,t)||e.startsWith(t))}function no(){return window.innerWidth<=1024}function nl(e){var t;if(!e)return"";if((0,K.Z)(e))return e;return(t=(t=e).trim().slice(0,1e3),Z.test(t)||Y.test(t))?V(e):e}var ns=/`(.*?)`/g,nd=RegExp("\\*{2}(?!\\*)(.*?)(?$1").replace(nc,"$1").replace(ns,"$1"))}function nh(e){return e.replace(nd,"$1").replace(nc,"$1").replace(ns,"$1")}function np(e){var t;let{headers:n}=e,i=n.length>0,r=(null==(t=n[0])?void 0:t.depth)||2,a=tB();return(0,T.useEffect)(()=>{let e;setTimeout(()=>{e=tF()},100);let t=decodeURIComponent(window.location.hash);if(t){let e=document.getElementById(t.slice(1));e&&tH(e,!1,a?0:72)}else window.scrollTo(0,0);return()=>{e&&e()}},[n]),(0,z.jsx)("div",{className:"flex flex-col",children:(0,z.jsx)("div",{className:i?"(0,z.jsx)("li",{children:(0,z.jsx)("a",{href:`#${e.id}`,title:nh(e.text),className:"aside-link transition-all duration-300 hover:text-text-1 text-text-2 block",style:{paddingLeft:(e.depth-r)*12,fontWeight:"semibold"},onClick:t=>{t.preventDefault(),window.location.hash=e.id;let n=document.getElementById(e.id);n&&tH(n,!1,a?0:72)},children:(0,z.jsx)("span",{className:"aside-link-text block",children:nu(e.text)})})},e.id))})})]})})})}var nm="prev_e7091",nf="next_e7091";function ng(){let{prevPage:e,nextPage:t}=tL(),{lastUpdated:n=!1}=tT(),{siteData:i}=(0,_.Vi)(),{themeConfig:r}=i,a=r.lastUpdated||n;return(0,z.jsxs)("footer",{className:"mt-8",children:[(0,z.jsx)("div",{className:"xs:flex pb-5 px-2 justify-end items-center",children:a&&(0,z.jsx)(io,{})}),(0,z.jsx)("div",{className:"flex flex-col",children:(0,z.jsx)(n5,{})}),(0,z.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-around gap-4 pt-6",children:[(0,z.jsx)("div",{className:`${nm} flex flex-col`,children:e?(0,z.jsx)(iU,{type:"prev",text:e.text,href:(0,N.AP)(e.link)}):null}),(0,z.jsx)("div",{className:`${nf} flex flex-col`,children:t?(0,z.jsx)(iU,{type:"next",text:t.text,href:(0,N.AP)(t.link)}):null})]})]})}function nx(e){var{icon:t}=e,n=tP(e,["icon"]);return t?"string"==typeof t?(0,z.jsx)("img",tj({src:t,alt:""},n)):(0,z.jsx)(t,tj({},n)):null}function nv({outlineTitle:e,beforeSidebar:t,afterSidebar:n,uiSwitch:i}){let[r,a]=(0,T.useState)(!1),[o,l]=(0,T.useState)(!1),s=(0,T.useRef)(),d=(0,T.useRef)(),{pathname:c}=(0,O.TH)();(0,T.useEffect)(()=>{a(!1)},[c]),(0,T.useEffect)(()=>(document.addEventListener("mouseup",u),document.addEventListener("touchend",u),()=>{document.addEventListener("mouseup",u),document.removeEventListener("touchend",u)}),[]);let u=e=>{let{current:t}=d;if(null==t?void 0:t.contains(e.target))return;let{current:n}=s;n&&!n.contains(e.target)&&l(!1)};return(0,z.jsxs)(T.Fragment,{children:[(0,z.jsxs)("div",{className:"rspress-sidebar-menu",children:[i.showSidebar?(0,z.jsxs)("button",{onClick:function(){a(!0)},className:"flex-center mr-auto",children:[(0,z.jsx)("div",{className:"text-md mr-2",children:(0,z.jsx)(nx,{icon:J})}),(0,z.jsx)("span",{className:"text-sm",children:"Menu"})]}):null,i.showAside?(0,z.jsxs)(T.Fragment,{children:[(0,z.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex-center ml-auto",ref:d,children:[(0,z.jsx)("span",{className:"text-sm",children:e}),(0,z.jsx)("div",{className:"text-md mr-2",style:{transform:o?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease-out",marginTop:"2px"},children:(0,z.jsx)(nx,{icon:Q})})]}),(0,z.jsx)(eg,{in:o,timeout:300,unmountOnExit:!0,classNames:"fly-in",nodeRef:s,children:(0,z.jsx)("div",{className:"rspress-local-toc-container",ref:s,children:(0,z.jsx)(rp,{onItemClick:()=>{l(!1)}})})})]}):null]}),i.showSidebar?(0,z.jsxs)(T.Fragment,{children:[(0,z.jsx)(ro,{isSidebarOpen:r,beforeSidebar:t,afterSidebar:n,uiSwitch:i}),r?(0,z.jsx)("div",{onClick:function(){a(!1)},className:"rspress-sidebar-back-drop",style:{background:"rgba(0, 0, 0, 0.6)"}}):null]}):null]})}var nb=(0,T.createContext)({tabData:{},setTabData:()=>{}}),ny={asideContainer:"aside-container_edeb4",docLayout:"docLayout_edeb4",content:"content_edeb4"};function nw(e){var t,n;let{beforeDocFooter:i,afterDocFooter:r,beforeDoc:a,afterDoc:o,beforeDocContent:l,afterDocContent:s,beforeOutline:d,afterOutline:c,beforeSidebar:u,afterSidebar:h,uiSwitch:p}=e,{siteData:m,page:f}=(0,_.Vi)(),{toc:g=[],frontmatter:x}=f,[v,b]=(0,T.useState)({}),{themeConfig:y}=m,w=null!=(t=y.enableScrollToTop)&&t,k=tT(),j=(null==k?void 0:k.outlineTitle)||(null==y?void 0:y.outlineTitle)||"ON THIS PAGE",I=null!=(n=null==x?void 0:x.overview)&&n,P=(0,z.jsx)(nb.Provider,{value:{tabData:v,setTabData:b},children:(0,z.jsx)(D.Zo,{components:nX(),children:(0,z.jsx)(B,{})})});return(0,z.jsxs)("div",{className:`${ny.docLayout} pt-0`,style:tj({},p.showNavbar?{}:{marginTop:0}),children:[a,(0,z.jsx)(nv,{outlineTitle:j,beforeSidebar:u,afterSidebar:h,uiSwitch:p}),(0,z.jsxs)("div",{className:`${ny.content} rspress-doc-container flex flex-shrink-0 mx-auto`,children:[(0,z.jsx)("div",{className:"w-full flex-1",children:I?(0,z.jsxs)(z.Fragment,{children:[l,(0,z.jsx)(iR,{content:P}),s]}):(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"rspress-doc",children:[l,P,s]}),(0,z.jsxs)("div",{className:"rspress-doc-footer",children:[i,p.showDocFooter&&(0,z.jsx)(ng,{}),r]})]})}),w&&(0,z.jsx)(H,{children:(0,z.jsx)(iG,{})}),p.showAside?(0,z.jsx)("div",{className:ny.asideContainer,style:tj({},p.showNavbar?{}:{marginTop:0,paddingTop:"32px"}),children:(0,z.jsxs)("div",{children:[d,(0,z.jsx)(np,{headers:g,outlineTitle:j}),c]})}):null]}),o]})}var nk=(e,t)=>t?(e=e.trim(),(t=t.trim()).startsWith("-")||t.startsWith("|"))?`${e} ${t}`:`${e} - ${t}`:e,nj=e=>{var t;let{top:n,bottom:i,beforeDocFooter:r,afterDocFooter:a,beforeDoc:o,afterDoc:l,beforeDocContent:s,afterDocContent:d,beforeSidebar:c,afterSidebar:u,beforeOutline:h,afterOutline:p,beforeNavTitle:m,afterNavTitle:f,beforeNav:g,beforeHero:x,afterHero:v,beforeFeatures:b,afterFeatures:y,afterNavMenu:w}=e,k={beforeDocFooter:r,afterDocFooter:a,beforeDocContent:s,afterDocContent:d,beforeDoc:o,afterDoc:l,beforeSidebar:c,afterSidebar:u,beforeOutline:h,afterOutline:p},j={beforeHero:x,afterHero:v,beforeFeatures:b,afterFeatures:y},{siteData:I,page:P}=(0,_.Vi)(),{pageType:S,lang:E,title:C,frontmatter:N={}}=P,M=tT();t8();let L=null!=(t=N.title)?t:C,R=I.title||M.title;L=L&&"doc"===S?nk(L,N.titleSuffix||R):"home"===S?nk(R,N.titleSuffix):"404"===S?nk("404",R):R;let $=(null==N?void 0:N.description)||I.description||M.description,D=function(){var e,t;let{page:n,siteData:i}=(0,_.Vi)(),{frontmatter:r}=n,{themeConfig:a}=i,o=tT(),l=(0,O.TH)(),s=null!=(e=null==r?void 0:r.overview)&&e,d=()=>{var e,t;let n="undefined"==typeof window||window.top===window.self;return(null!=(t=null!=(e=null==r?void 0:r.outline)?e:null==a?void 0:a.outline)?t:n)&&!s},[c,u]=t$(),[h,p]=(0,T.useState)(d()),[m,f]=(0,T.useState)(null==(t=null==r?void 0:r.footer)||t),g=o.sidebar||{},x=(null==r?void 0:r.sidebar)!==!1&&Object.keys(g).length>0;return(0,T.useEffect)(()=>{p(d())},[n,i]),(0,T.useEffect)(()=>{let e=new URLSearchParams(l.search),t=document.documentElement.style,n=t.getPropertyValue("--rp-sidebar-width"),i=t.getPropertyValue("--rp-aside-width"),r=e.get("navbar"),a=e.get("sidebar"),o=e.get("outline"),s=e.get("footer");return"0"===r&&u(!1),"0"===a&&document.documentElement.style.setProperty("--rp-sidebar-width","0px"),"0"===o&&document.documentElement.style.setProperty("--rp-aside-width","0px"),"0"===s&&f(!1),()=>{document.documentElement.style.setProperty("--rp-sidebar-width",n),document.documentElement.style.setProperty("--rp-aside-width",i),u(c),f(m)}},[l.search]),(0,T.useEffect)(()=>{F._f&&history.scrollRestoration&&(history.scrollRestoration=l.hash.length?"manual":"auto")},[!l.hash.length]),{showAside:h,showNavbar:c,showSidebar:x,showDocFooter:m}}();return(0,z.jsxs)("div",{children:[(0,z.jsxs)(A.ql,{htmlAttributes:{lang:E||"en"},children:[L?(0,z.jsx)("title",{children:L}):null,$?(0,z.jsx)("meta",{name:"description",content:$}):null]}),n,"blank"!==S&&D.showNavbar&&(0,z.jsx)(iM,{beforeNavTitle:m,afterNavTitle:f,beforeNav:g,afterNavMenu:w}),(0,z.jsx)("section",{children:(()=>{switch(S){case"home":return(0,z.jsx)(rm.HomeLayout,tj({},j));case"doc":return(0,z.jsx)(nw,tI(tj({},k),{uiSwitch:D}));case"404":return(0,z.jsx)(rm.NotFoundLayout,{});case"custom":case"blank":return(0,z.jsx)(B,{});default:return(0,z.jsx)(nw,tj({},k))}})()}),i]})};function nI(e){let{beforeHero:t,afterHero:n,beforeFeatures:i,afterFeatures:r}=e,{page:{frontmatter:a,routePath:o}}=(0,_.Vi)();return(0,z.jsxs)("div",{className:"relative",style:{minHeight:"calc(100vh - var(--rp-nav-height))",paddingBottom:"80px"},children:[(0,z.jsxs)("div",{className:"pb-12",children:[t,(0,z.jsx)(ir,{frontmatter:a,routePath:o}),n,i,(0,z.jsx)(n8,{frontmatter:a}),r]}),(0,z.jsx)(n9,{})]})}var nP={title:"title_3b154",blockquote:"blockquote_3b154",link:"link_3b154","inline-link":"inline-link_3b154"},nS=e=>(0,z.jsx)("h1",tI(tj({},e),{className:`text-3xl mb-10 leading-10 tracking-tight ${nP.title}`})),nE=e=>(0,z.jsx)("h2",tI(tj({},e),{className:`mt-12 mb-6 pt-8 text-2xl tracking-tight border-t-[1px] border-divider-light ${nP.title}`})),nC=e=>(0,z.jsx)("h3",tI(tj({},e),{className:`mt-10 mb-2 leading-7 text-xl ${nP.title}`})),n_=e=>(0,z.jsx)("h4",tI(tj({},e),{className:`mt-8 leading-6 text-lg ${nP.title}`})),nN=e=>(0,z.jsx)("h5",tI(tj({},e),{className:nP.title})),nz=e=>(0,z.jsx)("h6",tI(tj({},e),{className:nP.title})),nA=e=>(0,z.jsx)("ol",tI(tj({},e),{className:"list-decimal pl-5 my-4 leading-7"})),nT=e=>(0,z.jsx)("ul",tI(tj({},e),{className:"list-disc pl-5 my-4 leading-7"})),nO=e=>(0,z.jsx)("li",tI(tj({},e),{className:"[&:not(:first-child)]:mt-2"})),nM=e=>(0,z.jsx)("table",tI(tj({},e),{className:"block border-collapse text-base my-5 overflow-x-auto leading-7 border-gray-light-3 dark:border-divider"})),nL=e=>(0,z.jsx)("tr",tI(tj({},e),{className:"border border-solid transition-colors duration-500 even:bg-soft border-gray-light-3 dark:border-divider"})),nR=e=>(0,z.jsx)("td",tI(tj({},e),{className:"border border-solid px-4 py-2 border-gray-light-3 dark:border-divider"})),n$=e=>(0,z.jsx)("th",tI(tj({},e),{className:"border border-solid px-4 py-2 text-text-1 text-base font-semibold border-gray-light-3 dark:border-divider"})),nB=e=>(0,z.jsx)("hr",tI(tj({},e),{className:"my-12 border-t border-solid border-divider-light"})),nD=e=>{let{href:t="",className:n=""}=e,{normalizeLinkHref:i}=tq();return n.includes("header-anchor")||t.startsWith("#")?(0,z.jsx)("a",tI(tj({},e),{className:`${nP.link} ${n}`})):(0,z.jsx)(is,tI(tj({},e),{className:`${n} ${nP.link} ${nP["inline-link"]}`,href:i(t)}))},nH=e=>(0,z.jsx)("p",tI(tj({},e),{className:"my-4 leading-7"})),nF=e=>(0,z.jsx)("blockquote",tI(tj({},e),{className:`border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${nP.blockquote}`})),nW=e=>(0,z.jsx)("strong",tI(tj({},e),{className:"font-semibold"})),nq={"code-button-group":"code-button-group_15153",codeButtonGroup:"code-button-group_15153","code-copy-button":"code-copy-button_15153",codeCopyButton:"code-copy-button_15153","icon-success":"icon-success_15153",iconSuccess:"icon-success_15153","code-copied":"code-copied_15153",codeCopied:"code-copied_15153","icon-copy":"icon-copy_15153",iconCopy:"icon-copy_15153","icon-wrapped":"icon-wrapped_15153",iconWrapped:"icon-wrapped_15153","wrapped-btn":"wrapped-btn_15153",wrappedBtn:"wrapped-btn_15153","icon-wrap":"icon-wrap_15153",iconWrap:"icon-wrap_15153"},nU={doctype:{color:"var(--code-token-text)",fontStyle:"italic"},token:{color:"var(--code-token-text)"},comment:{color:"var(--code-token-comment)"},punctuation:{color:"var(--code-token-punctuation)"},property:{color:"var(--code-token-parameter)"},constant:{color:"var(--code-token-constant)"},string:{color:"var(--code-token-string)"},symbol:{color:"var(--code-token-symbol)"},variable:{color:"var(--code-token-variable)"},"attr-name":{color:"var(--code-token-symbol)"},"attr-value":{color:"var(--code-token-string-expression)"},builtin:{color:"var(--code-token-symbol)"},function:{color:"var(--code-token-function)"},keyword:{color:"var(--code-token-keyword)"},tag:{color:"var(--code-token-function)"},inserted:{color:"var(--code-token-inserted)"},deleted:{color:"var(--code-token-deleted)"},regex:{color:"var(--code-token-keyword)"},key:{color:"var(--code-token-variable)"},title:{color:"var(--code-token-keyword)"},important:{color:"#EBCB8B",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},table:{display:"content"}},nV=!1;function nG(e){var t;let{siteData:n}=(0,_.Vi)(),{meta:i,language:r,codeWrap:a}=e,{showLineNumbers:o}=n.markdown,l="",s=[];return i&&(l=(null==(t=/{[\d,-]*}/i.exec(i))?void 0:t[0])||"")&&(s=l.replace(/[{}]/g,"").split(",").map(e=>{let[t,n]=e.split("-");return n?Array.from({length:Number(n)-Number(t)+1},(e,n)=>n+Number(t)):Number(t)}).flat()),!nV&&(Object.keys(ey).forEach(e=>{eH.registerLanguage(e,ey[e])}),eH.alias(eb),nV=!0),(0,z.jsx)(eH,{language:r,style:nU,wrapLines:!0,className:"code",wrapLongLines:a,customStyle:{backgroundColor:"inherit"},showLineNumbers:o||s.length>0,lineProps:e=>({style:tI(tj({},s.includes(e)?{backgroundColor:"var(--rp-code-line-highlight-color)"}:{}),{display:"block",padding:"0 1.25rem"})}),children:String(e.children).trim()})}var nZ=new Map;function nY({codeBlockRef:e}){let t=(0,T.useRef)(null);return(0,z.jsxs)("button",{className:nq.codeCopyButton,onClick:()=>(function(e,t){let n="",i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),r=i.nextNode();for(;r;)!r.parentElement.classList.contains("linenumber")&&(n+=r.nodeValue),r=i.nextNode();if(eF(n)&&t){t.classList.add(nq.codeCopied),clearTimeout(nZ.get(t));let e=setTimeout(()=>{t.classList.remove(nq.codeCopied),t.blur(),nZ.delete(t)},2e3);nZ.set(t,e)}})(e.current,t.current),ref:t,title:"Copy code",children:[(0,z.jsx)(nx,{icon:eW,className:nq.iconCopy}),(0,z.jsx)(nx,{icon:eq,className:nq.iconSuccess})]})}function nK(e){var t;let{siteData:n}=(0,_.Vi)(),i=null!=(t=e.codeHighlighter)?t:n.markdown.codeHighlighter,{defaultWrapCode:r}=n.markdown,[a,o]=(0,T.useState)(r),l=(0,T.useRef)(null),s=(0,T.useRef)(),{className:d}=e,c=null==d?void 0:d.replace(/language-/,"");if(!c)return(0,z.jsx)("code",tj({},e));let u=e=>{a?null==e||e.classList.remove(nq.wrappedBtn):null==e||e.classList.add(nq.wrappedBtn),o(!a)};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{ref:s,children:(()=>{if("prism"===i)return(0,z.jsx)(nG,tI(tj({},e),{language:c,codeWrap:a}));return(0,z.jsx)("code",tj({},e))})()}),(0,z.jsxs)("div",{className:nq.codeButtonGroup,children:[(0,z.jsxs)("button",{ref:l,className:nq.codeWrapButton,onClick:()=>u(l.current),title:"Toggle code wrap",children:[(0,z.jsx)(nx,{icon:ev,className:nq.iconWrapped}),(0,z.jsx)(nx,{icon:ex,className:nq.iconWrap})]}),(0,z.jsx)(nY,{codeBlockRef:s})]})]})}function nJ({children:e}){let t=e=>{let{className:t,meta:n}=e.props,i=function(e){var t,n;if(!e)return"";let i=e,r=/{[\d,-]*}/i;return(null==(t=r.exec(e))?void 0:t[0])&&(i=e.replace(r,"").trim()),null==(i=null!=(n=i.split("=")[1])?n:"")?void 0:i.replace(/["'`]/g,"")}(n);return(0,z.jsxs)("div",{className:t||"language-bash",children:[i&&(0,z.jsx)("div",{className:"rspress-code-title",children:i}),(0,z.jsx)("div",{className:"rspress-code-content rspress-scrollbar",children:e})]})};return Array.isArray(e)?(0,z.jsx)("div",{children:e.map(e=>t(e))}):t(e)}var nQ=e=>(0,z.jsx)("img",tI(tj({},e),{src:(0,N.i6)(e.src||"")}));function nX(){return{h1:nS,h2:nE,h3:nC,h4:n_,h5:nN,h6:nz,ul:nT,ol:nA,li:nO,table:nM,td:nR,th:n$,tr:nL,hr:nB,p:nH,blockquote:nF,strong:nW,a:nD,code:nK,pre:nJ,img:nQ}}var n0={badge:"badge_99dcf",info:"info_99dcf",warning:"warning_99dcf",danger:"danger_99dcf"};function n1(e){let{text:t,type:n="info"}=e;return(0,z.jsx)("span",{className:`inline-block rounded-full border border-solid border-transparent font-medium ${n0.badge} ${n0[n]}`,children:t})}var n2={button:"button_72e53",medium:"medium_72e53",big:"big_72e53",brand:"brand_72e53",alt:"alt_72e53"};function n3(e){let{theme:t="brand",size:n="big",href:i="/",external:r=!1,className:a=""}=e,o=null;return"button"===e.type?o="button":"a"===e.type&&(o=r?"a":is),T.createElement(null!=o?o:"a",{className:`${n2.button} ${n2[t]} ${n2[n]} ${a}`,href:i},e.text)}var n4="editLink_2a169";function n5(){let e=tR();if(!e)return null;let{text:t,link:n}=e;return(0,z.jsx)("a",{href:n,target:"_blank",className:n4,children:t})}var n6={"grid-2":"grid-2_d48e3",grid2:"grid-2_d48e3","grid-4":"grid-4_d48e3",grid4:"grid-4_d48e3","grid-6":"grid-6_d48e3",grid6:"grid-6_d48e3","grid-3":"grid-3_d48e3",grid3:"grid-3_d48e3",featureCard:"featureCard_d48e3"},n7=e=>{let{span:t}=e;return`grid-${t||4}`};function n8({frontmatter:e}){let t=null==e?void 0:e.features;return(0,z.jsx)("div",{className:"overflow-hidden m-auto flex flex-wrap max-w-6xl",children:null==t?void 0:t.map(e=>{let{icon:t,title:n,details:i,link:r}=e;return(0,z.jsx)("div",{className:`${n6[n7(e)]} rounded hover:var(--rp-c-brand)`,children:(0,z.jsx)("div",{className:"h-full p-2",children:(0,z.jsxs)("article",{className:`rspress-home-feature-card ${n6.featureCard} h-full p-8 rounded-4xl border-transparent`,style:{cursor:r?"pointer":"auto"},onClick:()=>{r&&(window.location.href=r)},children:[t?(0,z.jsx)("div",{className:"flex-center",children:(0,z.jsx)("div",{className:"rspress-home-feature-icon w-12 h-12 text-3xl text-center",children:t})}):null,(0,z.jsx)("h2",{className:"rspress-home-feature-title font-bold text-center",children:n}),(0,z.jsx)("p",{className:"rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",children:nl(i)})]},n)})},n)})})}function n9(){let{siteData:e}=(0,_.Vi)(),{message:t}=e.themeConfig.footer||{};return(0,z.jsx)("footer",{className:"absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",children:(0,z.jsx)("div",{className:"m-auto w-full text-center",children:t&&(0,z.jsx)("div",{className:"font-meduim text-sm text-text-2",dangerouslySetInnerHTML:{__html:t}})})})}var ie="clip_c867a",it="mask_c867a",ii={name:"modern",text:"modern ssg",tagline:"modern ssg",actions:[],image:void 0};function ir({frontmatter:e,routePath:t}){var n,i,r,a,o,l,s,d,c;let u=(null==e?void 0:e.hero)||ii,h=void 0!==u.image,p=h?"sm:max-w-xl":"sm:max-w-4xl",m=u.text?u.text.toString().split(/\n/g).filter(e=>""!==e):[],f="string"==typeof(null==(n=u.image)?void 0:n.src)?{light:u.image.src,dark:u.image.src}:(null==(i=u.image)?void 0:i.src)||{light:"",dark:""};return(0,z.jsxs)("div",{className:"m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16 relative",children:[(0,z.jsx)("div",{className:it,style:{left:h?"75%":"50%"}}),(0,z.jsxs)("div",{className:"m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh] mt-12 sm:mt-0",children:[(0,z.jsxs)("div",{className:"flex flex-col justify-center items-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1",children:[(0,z.jsx)("h1",{className:"font-bold text-3xl pb-2 sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-2 leading-tight z-10",children:(0,z.jsx)("span",{className:ie,style:{lineHeight:"1.3"},children:nl(u.name)})}),0!==m.length&&m.map(e=>(0,z.jsx)("p",{className:`rspress-home-hero-text mx-auto md:m-0 text-3xl sm:text-5xl md:text-6xl sm:pb-2 font-bold z-10 ${p}`,style:{lineHeight:"1.2"},children:nl(e)},e)),(0,z.jsx)("p",{className:`rspress-home-hero-tagline whitespace-pre-wrap pt-4 m-auto md:m-0 text-sm sm:tex-xl md:text-[1.5rem] text-text-2 font-medium z-10 ${p}`,children:nl(u.tagline)}),(null==(r=u.actions)?void 0:r.length)&&(0,z.jsx)("div",{className:"grid md:flex md:flex-wrap md:justify-center gap-3 m--1.5 pt-6 sm:pt-8 z-10",children:u.actions.map(e=>(0,z.jsx)("div",{className:"flex flex-shrink-0 p-1",children:(0,z.jsx)(n3,{type:"a",text:nl(e.text),href:(0,N.AP)((0,F.pJ)(e.link,t)),theme:e.theme,className:"w-full"})},e.link))})]}),h?(0,z.jsxs)("div",{className:"rspress-home-hero-image md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",children:[(0,z.jsx)("img",{src:(0,N.i6)(f.light),alt:null==(a=u.image)?void 0:a.alt,srcSet:ia(null==(o=u.image)?void 0:o.srcset),sizes:ia(null==(l=u.image)?void 0:l.sizes),width:375,height:375,className:"dark:hidden"}),(0,z.jsx)("img",{src:(0,N.i6)(f.dark),alt:null==(s=u.image)?void 0:s.alt,srcSet:ia(null==(d=u.image)?void 0:d.srcset),sizes:ia(null==(c=u.image)?void 0:c.sizes),width:375,height:375,className:"hidden dark:block"})]}):null]})]})}function ia(e){return(Array.isArray(e)?e:[e]).filter(Boolean).join(", ")||void 0}function io(){let{lastUpdatedText:e="Last Updated"}=tT(),{page:{lastUpdatedTime:t},siteData:n}=(0,_.Vi)(),{themeConfig:i}=n,r=(null==i?void 0:i.lastUpdatedText)||e;return(0,z.jsx)("div",{className:"flex text-sm text-text-2 leading-6 sm:leading-8 font-medium",children:(0,z.jsxs)("p",{children:[r,": ",(0,z.jsx)("span",{children:t})]})})}var il={link:"link_03735"};function is(e){let{href:t="/",children:n,className:i="",onNavigate:r,keepCurrentParams:a=!1}=e,o=tP(e,["href","children","className","onNavigate","keepCurrentParams"]),l=(0,F.xf)(t),s=l?"_blank":"",d=l?"noopener noreferrer":void 0,c=l?t:(0,N.pJ)((0,N.AP)(t)),u=(0,O.s0)(),{pathname:h,search:p}=(0,O.TH)(),m=a?c+p:c,f=(0,N.pV)(h,c);return l?(0,z.jsx)("a",tI(tj({},o),{href:c,target:s,rel:d,className:`${il.link} ${i}`,children:n})):(0,z.jsx)("a",tI(tj({},o),{className:`${il.link} ${i} cursor-pointer`,rel:d,target:s,onClick:e=>tz(this,null,function*(){if(0!==e.button||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return;e.preventDefault();let t=c.split("#")[1];if(!l&&f&&t){let e=document.getElementById(t);e&&tH(e,!0);return}if(!f){let e=(0,M.fp)(eV.routes,(0,N.Tm)(c));if(null==e?void 0:e.length){let t=setTimeout(()=>{eU.start()},200);yield e[0].route.preload(),clearTimeout(t),eU.done()}null==r||r(),u(m,{replace:!1})}}),href:c,children:n}))}eU.configure({showSpinner:!1});var id={hidden:"hidden_f6cde",container:"container_f6cde",navContainer:"navContainer_f6cde",leftNav:"leftNav_f6cde",rightNav:"rightNav_f6cde",singleItem:"singleItem_f6cde",activeItem:"activeItem_f6cde",navBarTitle:"navBarTitle_f6cde",menuItem:"menu-item_f6cde",mobileNavMenu:"mobileNavMenu_f6cde"};function ic(e){let{pathname:t,base:n}=e,i=new RegExp(e.activeMatch||e.link).test((0,F.tz)(t,n));return(0,z.jsx)(is,{href:(0,N.AP)(e.link),children:(0,z.jsxs)("div",{className:`rspress-nav-menu-item ${id.singleItem} ${i?id.activeItem:""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,children:[(0,z.jsx)(ru,{tag:e.tag}),e.text,e.rightIcon]},e.text)})}function iu({onClick:e}){let{theme:t,setTheme:n}=(0,T.useContext)(_.Ni);return(0,z.jsx)("div",{onClick:()=>{n("dark"===t?"light":"dark"),null==e||e()},className:"md:mr-2 rspress-nav-appearance",children:(0,z.jsxs)("div",{className:"p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300 w-7 h-7",children:[(0,z.jsx)(nx,{className:"dark:hidden",icon:tt,width:"18",height:"18",fill:"currentColor"}),(0,z.jsx)(nx,{className:"hidden dark:block",icon:tn,width:"18",height:"18",fill:"currentColor"})]})})}var ih={socialLinksIcon:"social-links-icon_93d67",menuItem:"menu-item_93d67"},ip={discord:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Discord"}),(0,z.jsx)("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]}),facebook:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Facebook"}),(0,z.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})]}),github:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"GitHub"}),(0,z.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),gitlab:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"GitLab"}),(0,z.jsx)("path",{fill:"currentColor",d:"m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"})]}),instagram:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Instagram"}),(0,z.jsx)("path",{d:"M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"})]}),linkedin:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"LinkedIn"}),(0,z.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})]}),slack:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Slack"}),(0,z.jsx)("path",{d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})]}),twitter:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Twitter"}),(0,z.jsx)("path",{d:"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"})]}),youtube:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"YouTube"}),(0,z.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})]}),juejin:(0,z.jsxs)("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg","data-spm-anchor-id":"a313x.7781069.0.i5",children:[(0,z.jsx)("path",{d:"M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z","data-spm-anchor-id":"a313x.7781069.0.i2"}),(0,z.jsx)("path",{d:"M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z","data-spm-anchor-id":"a313x.7781069.0.i3"})]}),qq:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"})}),wechat:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"})}),weibo:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"})}),zhihu:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"})}),bilibili:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"})}),lark:(0,z.jsxs)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Lark"}),(0,z.jsx)("path",{d:"M8.813 5.477c1.038.836 2.286 2.045 3.3 3.495.171.23.377.576.457.71l.034.056a8.803 8.803 0 0 0-.922 1.3l-.271-.494C9.655 7.53 6.3 5.477 6.137 5.377a.447.447 0 0 1-.006-.004l-.666-.393-.107-.086a.499.499 0 0 1 .306-.885L6.084 4h7.997c.159.006.318.037.47.092.174.064.317.174.458.308.134.143.272.296.403.448.622.675 1.324 1.688 1.324 1.688-.573.193-1.349.736-1.349.736a5.095 5.095 0 0 0-.348-.54 20.665 20.665 0 0 0-1.037-1.255H8.813Z",fill:"currentColor"}),(0,z.jsx)("path",{d:"M18.482 7.507a5.42 5.42 0 0 1 4.04.717c.248.168.788.635.242 1.233-1.7 1.67-2.194 3.225-2.63 4.599-.278.873-.541 1.697-1.066 2.424-1.813 2.508-4.114 4-6.837 4.434-.561.089-1.132.131-1.7.131-3.958 0-7.498-2.035-8.75-2.844h.003l-.161-.107c-.534-.378-.61-.723-.623-.989V7.055a.486.486 0 0 1 .827-.317l.482.589c5.082 6.201 9.126 8.063 11.626 8.53 2.246.424 3.631-.165 4.022-.37.333-.51.534-1.143.764-1.865l.006-.021c.406-1.276.898-2.821 2.322-4.477a3.93 3.93 0 0 0-2.28-.168c-1.761.394-3.403 1.96-4.89 4.643a8.27 8.27 0 0 0-.341.671c-.724-.107-1.334-.65-1.334-.65.128-.269.22-.455.345-.672 1.718-3.125 3.714-4.962 5.933-5.441ZM2.477 16.889c1.145.744 5.341 3.232 9.532 2.563 1.56-.247 2.963-.915 4.196-1.99-2.771.254-7.557-.753-13.728-7.666v7.093Z",fill:"currentColor"})]}),X:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"X"}),(0,z.jsx)("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})]})},im=e=>{let{link:t,popperStyle:n={}}=e,{icon:i,mode:r="link",content:a}=t,o="object"==typeof i?(0,z.jsx)("div",{dangerouslySetInnerHTML:{__html:i.svg}}):ip[i],[l,s]=(0,T.useState)(!1),d=()=>{s(!0)},c=()=>{s(!1)};return"link"===r?(0,z.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"social-links",children:(0,z.jsx)("div",{className:`${ih.socialLinksIcon}`,children:o})},a):"text"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative mx-3`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{style:tj({boxShadow:"var(--rp-shadow-3)",border:"1px solid var(--rp-c-divider-light)"},n),className:"z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",children:(0,z.jsx)("div",{className:"text-md",children:a})}):null]}):"img"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{className:"break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",style:tj({boxShadow:"var(--rp-shadow-3)"},n),children:(0,z.jsx)("img",{src:a,alt:"img"})}):null]}):"dom"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{className:"break-all z-[1] p-3 absolute right-0 bg-white dark:bg-dark rounded-xl",style:tj({boxShadow:"var(--rp-shadow-3)"},n),children:(0,z.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})}):null]}):(0,z.jsx)("div",{})},ig=e=>{let{links:t,moreIconVisible:n=!1,mouseEnter:i}=e;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"flex-center h-full gap-x-4 transition-colors duration-300 md:mr-2",children:t.map((e,t)=>(0,z.jsx)(im,{link:e,popperStyle:{top:"2.5rem"}},t))}),n?(0,z.jsx)("div",{className:"md:ml-1 p-2",onMouseEnter:i,children:(0,z.jsx)(nx,{icon:ti})}):null]})},ix=e=>{let{links:t}=e;return(0,z.jsx)("div",{style:{boxShadow:"var(--rp-shadow-3)",marginRight:"-2px",border:"1px solid var(--rp-c-divider-light)",background:"var(--rp-c-bg)"},className:"absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",children:t.map(e=>(0,z.jsx)(im,{link:e,popperStyle:{top:"1.25rem"}},e.content))})},iv=({socialLinks:e})=>{let t=e.length>3,n=[],i=[];e.forEach((e,t)=>{t<3?n.push(e):i.push(e)});let[r,a]=(0,T.useState)(!1);return(0,z.jsxs)("div",{className:`social-links ${ih.menuItem} flex-center relative`,onMouseLeave:()=>a(!1),children:[(0,z.jsx)(ig,{links:n,moreIconVisible:t,mouseEnter:()=>a(!0)}),r?(0,z.jsx)(ix,{links:i}):null]})};function ib(){var e,t;let{siteData:n,page:i}=(0,_.Vi)(),r=(0,_.aw)(),{pathname:a,search:o}=(0,O.TH)(),l=n.lang||"",s=n.multiVersion.default||"",d=Object.values(n.locales||n.themeConfig.locales||{}),c=(null==(e=n.route)?void 0:e.cleanUrls)||!1,u=d.length>1,{lang:h,pageType:p}=i,{base:m}=n;return u?{text:(0,z.jsx)(nx,{icon:tr,style:{width:"18px",height:"18px"}}),items:d.map(e=>({text:null==e?void 0:e.label,link:(0,F.$U)(a+o,{current:h,target:e.lang,default:l},{current:r,default:s},m,c,"404"===p)})),activeValue:null==(t=d.find(e=>h===e.lang))?void 0:t.label}:null}function iy(){var e;let{siteData:t,page:n}=(0,_.Vi)(),i=(0,_.aw)(),{pathname:r}=(0,O.TH)(),a=(null==(e=t.route)?void 0:e.cleanUrls)||!1,o=t.multiVersion.default||"",l=t.multiVersion.versions||[],{base:s}=t;return{items:l.map(e=>({text:e,link:(0,F.xM)(r,{current:i,target:e,default:o},s,a,"404"===n.pageType)})),text:i,activeValue:i}}var iw={navScreen:"navScreen_457e8",active:"active_457e8",container:"container_457e8",navMenu:"navMenu_457e8",navMenuItem:"navMenuItem_457e8",navAppearance:"navAppearance_457e8",socialAndAppearance:"socialAndAppearance_457e8",navScreenMenuGroup:"navScreenMenuGroup_457e8",open:"open_457e8",button:"button_457e8",buttonSpan:"buttonSpan_457e8",items:"items_457e8",down:"down_457e8"};function ik(e){let{activeValue:t}=e,[n,i]=(0,T.useState)(!1);function r({item:e}){return(0,z.jsx)("div",{className:"p-1 text-center",children:(0,z.jsx)("span",{className:"text-brand",children:e.text})})}function a({item:e}){return(0,z.jsx)("div",{className:"py-1 font-medium",children:(0,z.jsx)(is,{href:e.link,children:(0,z.jsx)("div",{children:(0,z.jsx)("div",{className:"flex justify-center",children:(0,z.jsx)("span",{children:e.text})})})})})}let o=e=>t===e.text?(0,z.jsx)(r,{item:e},e.link):(0,z.jsx)(a,{item:e},e.link),l=e=>(0,z.jsxs)("div",{children:["link"in e?o(e):(0,z.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(o)]});return(0,z.jsxs)("div",{className:`${n?iw.open:""} ${iw.navScreenMenuGroup} relative`,children:[(0,z.jsxs)("button",{className:iw.button,onClick:()=>{i(!n)},children:[(0,z.jsx)("span",{className:iw.buttonSpan,children:e.text}),(0,z.jsx)(ta,{className:`${n?iw.open:""} ${iw.down} `})]}),(0,z.jsx)("div",{children:(0,z.jsx)("div",{className:iw.items,children:e.items.map(e=>(0,z.jsx)("div",{children:"items"in e?l(e):o(e)},e.text))})})]})}function ij(){let{nav:e}=tT(),t=(0,_.aw)();return Array.isArray(e)?e:[...e[t.length>0?t:"default"]]}var iI=()=>{let e=ib();return(0,z.jsx)("div",{className:"flex text-sm font-bold justify-center",children:(0,z.jsx)("div",{className:"mx-1.5 my-1",children:(0,z.jsx)(ik,tj({},e))})})},iP=()=>{let e=iy();return(0,z.jsx)("div",{className:`${iw.navTranslations} flex text-sm font-bold justify-center`,children:(0,z.jsx)("div",{className:"mx-1.5 my-1",children:(0,z.jsx)(ik,tj({},e))})})};function iS(e){var t;let{isScreenOpen:n,siteData:i,pathname:r}=e,a=(0,T.useRef)(null),o=i.themeConfig.locales||[],l=o.length>1,s=i.multiVersion.versions.length>1,d=ij(),c=!1!==i.themeConfig.darkMode,u=(null==(t=null==i?void 0:i.themeConfig)?void 0:t.socialLinks)||[],h=u.length>0,p=o.map(e=>e.lang||"zh")||[],{base:m}=i;return(0,T.useEffect)(()=>(a.current&&n&&e9(a.current,{reserveScrollBarGap:!0}),()=>{te()}),[n]),(0,z.jsx)("div",{className:`${iw.navScreen} ${n?iw.active:""}`,ref:a,id:"navScreen",children:(0,z.jsxs)("div",{className:iw.container,children:[(0,z.jsx)(({menuItems:e})=>(0,z.jsx)("div",{className:iw.navMenu,children:e.map(e=>(0,z.jsx)("div",{className:`${iw.navMenuItem} w-full`,children:"link"in e?(0,z.jsx)(ic,tj({pathname:r,base:m,langs:p},e),e.text):(0,z.jsx)("div",{className:"mx-3 last:mr-0",children:(0,z.jsx)(ik,tI(tj({},e),{items:"items"in e?e.items:e}))},e.text)},e.text))}),{menuItems:d}),(0,z.jsxs)("div",{className:"flex-center flex-col gap-2",children:[c&&(0,z.jsx)(()=>(0,z.jsx)("div",{className:`mt-2 ${iw.navAppearance} flex justify-center`,children:(0,z.jsx)(H,{children:(0,z.jsx)(iu,{})})}),{}),l&&(0,z.jsx)(iI,{}),s&&(0,z.jsx)(iP,{}),h&&(0,z.jsx)(iv,{socialLinks:u})]})]})})}var iE={navHamburger:"navHamburger_e7b06",active:"active_e7b06"};function iC(e){let{siteData:t,pathname:n}=e,{isScreenOpen:i,toggleScreen:r}=function(){let{pathname:e}=(0,O.TH)(),[t,n]=(0,T.useState)(!1);function i(){n(!0),window.addEventListener("resize",a)}function r(){n(!1),window.removeEventListener("resize",a)}function a(){window.outerWidth>=768&&r()}return(0,T.useEffect)(()=>{r()},[e]),{isScreenOpen:t,openScreen:i,closeScreen:r,toggleScreen:function(){t?r():i()}}}();return(0,z.jsxs)(T.Fragment,{children:[(0,z.jsx)(iS,{isScreenOpen:i,siteData:t,pathname:n}),(0,z.jsx)("button",{onClick:r,"aria-label":"mobile hamburger",className:`${i?iE.active:""} ${iE.navHamburger} text-gray-500`,children:(0,z.jsx)(nx,{icon:eG,fill:"currentColor"})})]})}function i_({item:e}){return(0,z.jsxs)("div",{className:"rounded-2xl my-1 flex",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:[e.tag&&(0,z.jsx)(ru,{tag:e.tag}),(0,z.jsx)("span",{className:"text-brand",children:e.text})]},e.link)}function iN({item:e}){return(0,z.jsx)("div",{className:"font-medium my-1",children:(0,z.jsx)(is,{href:e.link,children:(0,z.jsx)("div",{className:"rounded-2xl hover:bg-mute",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:(0,z.jsxs)("div",{className:"flex",children:[e.tag&&(0,z.jsx)(ru,{tag:e.tag}),(0,z.jsx)("span",{children:e.text})]})})})},e.link)}function iz(e){let{activeValue:t,items:n,base:i="",link:r="",pathname:a=""}=e,[o,l]=(0,T.useState)(!1),s=e=>{let n=new RegExp(e.activeMatch||e.link).test((0,F.tz)(a,i));return t===e.text||!t&&n?(0,z.jsx)(i_,{item:e},e.link):(0,z.jsx)(iN,{item:e},e.link)},d=e=>(0,z.jsxs)("div",{children:["link"in e?s(e):(0,z.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(s)]});return(0,z.jsxs)("div",{className:"relative flex-center h-14",onMouseLeave:()=>l(!1),children:[(0,z.jsx)("button",{onMouseEnter:()=>l(!0),className:"rspress-nav-menu-group-button flex-center items-center font-medium text-sm text-text-1 hover:text-text-2 transition-colors duration-200",children:r?(0,z.jsx)(ic,tI(tj({},e),{rightIcon:(0,z.jsx)(nx,{icon:ta})})):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("span",{className:"text-sm font-medium flex",style:{marginRight:"2px"},children:[(0,z.jsx)(ru,{tag:e.tag}),e.text]}),(0,z.jsx)(nx,{icon:ta})]})}),(0,z.jsx)("div",{className:"rspress-nav-menu-group-content absolute mx-0.8 transition-opacity duration-300",style:{opacity:o?1:0,visibility:o?"visible":"hidden",right:0,top:"52px"},children:(0,z.jsx)("div",{className:"p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",style:{boxShadow:"var(--rp-shadow-3)",zIndex:100,border:"1px solid var(--rp-c-divider-light)",borderRadius:"var(--rp-radius-large)",background:"var(--rp-c-bg)"},children:n.map(e=>(0,z.jsx)("div",{children:"items"in e?d(e):s(e)},e.text))})})]})}var iA=()=>{var e;let{siteData:t}=(0,_.Vi)(),n=tT(),{logo:i,logoText:r}=t,a=null!=(e=n.title)?e:t.title,o=(0,T.useMemo)(()=>i?"string"==typeof i?(0,z.jsx)("img",{src:(0,N.i6)(i),alt:"logo",id:"logo",className:"mr-4 rspress-logo"}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("img",{src:(0,N.i6)(i.light),alt:"logo",id:"logo",className:"mr-4 rspress-logo dark:hidden"}),(0,z.jsx)("img",{src:(0,N.i6)(i.dark),alt:"logo",id:"logo",className:"mr-4 rspress-logo hidden dark:block"})]}):null,[i]);return(0,z.jsx)("div",{className:`${id.navBarTitle}`,children:(0,z.jsxs)("a",{href:(0,N.pJ)(n.langRoutePrefix||"/"),className:"flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",children:[o,r&&(0,z.jsx)("span",{children:r}),!o&&!r&&(0,z.jsx)("span",{children:a})]})})};function iT(){let e=ib();return(0,z.jsx)("div",{className:`translation ${id.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,z.jsx)("div",{children:(0,z.jsx)(iz,tj({},e))})})}function iO(){let e=iy();return(0,z.jsx)("div",{className:`translation ${id.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,z.jsx)("div",{children:(0,z.jsx)(iz,tj({},e))})})}function iM(e){var t;let{beforeNavTitle:n,afterNavTitle:i,beforeNav:r,afterNavMenu:a}=e,{siteData:o}=(0,_.Vi)(),{base:l}=o,{pathname:s}=(0,O.TH)(),[d,c]=(0,T.useState)(!1),u=tB(),h=Object.values(o.locales||o.themeConfig.locales||{}),p=h.length>1,m=o.multiVersion.versions.length>1,f=o.themeConfig.socialLinks||[],g=f.length>0,x=h.map(e=>e.lang||"")||[],v=()=>{c(no())};(0,T.useEffect)(()=>(window.addEventListener("resize",v),c(no()),()=>{window.removeEventListener("resize",v)}),[]);let b=({menuItems:e})=>(0,z.jsx)("div",{className:"rspress-nav-menu menu h-14",children:e.map(e=>"items"in e||Array.isArray(e)?(0,z.jsx)("div",{className:"mx-3 last:mr-0",children:(0,z.jsx)(iz,tI(tj({},e),{base:l,pathname:s,langs:x,items:"items"in e?e.items:e}))},e.text):(0,z.jsx)(ic,tj({pathname:s,langs:x,base:l},e),e.link))}),y=ij(),w=e=>{var t;return null!=(t=e.position)?t:"right"},k=y.filter(e=>"left"===w(e)),j=y.filter(e=>"right"===w(e)),I=(null==(t=null==o?void 0:o.themeConfig)?void 0:t.search)!==!1,P=!1!==o.themeConfig.darkMode;return(0,z.jsxs)(z.Fragment,{children:[r,(0,z.jsx)("div",{className:`${id.navContainer} rspress-nav px-6 ${u&&!d?id.hidden:""}`,style:{position:d?"relative":"sticky"},children:(0,z.jsxs)("div",{className:`${id.container} flex justify-between items-center h-full`,children:[n,(0,z.jsx)(iA,{}),i,(0,z.jsxs)("div",{className:"flex flex-1 justify-end items-center",children:[k.length>0?(0,z.jsx)("div",{className:id.leftNav,children:(0,z.jsx)(b,{menuItems:k})}):null,(0,z.jsxs)("div",{className:id.rightNav,children:[I&&(0,z.jsx)("div",{className:"flex sm:flex-1 items-center sm:pl-4 sm:pr-2",children:(0,z.jsx)(i5,{})}),(0,z.jsx)(b,{menuItems:j}),(0,z.jsxs)("div",{className:"flex-center flex-row",children:[p&&(0,z.jsx)(iT,{}),m&&(0,z.jsx)(iO,{}),P&&(0,z.jsx)("div",{className:"mx-2",children:(0,z.jsx)(iu,{})}),g&&(0,z.jsx)(iv,{socialLinks:f})]})]}),a,(0,z.jsxs)("div",{className:id.mobileNavMenu,children:[d&&I&&(0,z.jsx)(i5,{}),(0,z.jsx)(iC,{siteData:o,pathname:s})]})]})]})})]})}var iL={"header-anchor":"header-anchor_8f375",headerAnchor:"header-anchor_8f375","overview-groups":"overview-groups_8f375",overviewGroups:"overview-groups_8f375","overview-group-li":"overview-group-li_8f375",overviewGroupLi:"overview-group-li_8f375","level-2":"level-2_8f375",level2:"level-2_8f375","level-3":"level-3_8f375",level3:"level-3_8f375","level-4":"level-4_8f375",level4:"level-4_8f375","overview-group":"overview-group_8f375",overviewGroup:"overview-group_8f375",header:"header_8f375"};function iR(e){var t;let{siteData:n,page:{routePath:i,title:r,frontmatter:a}}=(0,_.Vi)(),{content:o,groups:l,defaultGroupTitle:s="Others"}=e,d=e=>(0,N.pJ)(e).startsWith(i.replace(/overview$/,""))&&!(0,N.pV)((0,N.pJ)(e),i),c=e=>"link"in e&&e.link?e.link:"items"in e?c(e.items[0]):"",u=(e,t,n)=>{for(let i of e){if((0,N.pJ)(i.link)===t)return[i];if(i.items){let e=u(i.items,t,n);if(e)return e}}return n},{pages:h}=n,p=h.filter(e=>d(e.routePath)),{items:m}=tM();function f(t,n,r){var a,o,l,s,d;if("dividerType"in t)return t;if((0,N.pJ)(t.link)===`${i}index`&&(null==r?void 0:r.overview)===!0)return!1;let u=null!=(s=null!=(l=null!=(o=null!=(a=null==e?void 0:e.overviewHeaders)?a:t.overviewHeaders)?o:null==r?void 0:r.overviewHeaders)?l:null==n?void 0:n.overviewHeaders)?s:[2],h=p.find(e=>(0,N.pV)(e.routePath,(0,N.pJ)(t.link||""))),m=c(t);return tI(tj({},t),{link:m,headers:(null==(d=null==h?void 0:h.toc)?void 0:d.filter(e=>u.some(t=>e.depth===t)))||[]})}(null==(t=m[0])?void 0:t.link)!==i&&(m=u(m,i,m));let g=e=>!("items"in e)&&"link"in e,x=null!=l?l:(0,T.useMemo)(()=>m.filter(e=>"items"in e&&e.items?e.items.filter(e=>d(c(e))).length>0:!!(g(e)&&d(c(e)))||!1).map(e=>{var t;let n=[];return(null==e?void 0:e.items)?n=null==(t=null==e?void 0:e.items)?void 0:t.map(t=>f(t,e,a)).filter(Boolean):g(e)&&(n=[f({link:e.link,text:e.text||"",tag:e.tag,_fileKey:e._fileKey,overviewHeaders:e.overviewHeaders},void 0,a)]),{name:e.text||"",items:n}}),[m,i,a]);return(0,z.jsxs)("div",{className:"overview-index mx-auto px-8",children:[(0,z.jsx)("div",{className:"flex items-center justify-between",children:!r&&(0,z.jsx)("h1",{className:"text-3xl leading-10 tracking-tight",children:"Overview"})}),o,x.map(e=>(0,z.jsxs)("div",{className:"mb-16",children:[e.name===s&&1===x.length?(0,z.jsx)("h2",{style:{paddingTop:0}}):(0,z.jsx)("h2",{children:nu(e.name)}),(0,z.jsx)("div",{className:iL.overviewGroups,children:e.items.map(e=>{var t;return(0,z.jsxs)("div",{className:iL.overviewGroup,children:[(0,z.jsx)("div",{className:"flex",children:(0,z.jsx)("h3",{style:{marginBottom:8},children:(0,z.jsx)(is,{href:(0,N.AP)(e.link),children:nu(e.text)})})}),(0,z.jsx)("ul",{className:"list-none",children:null==(t=e.headers)?void 0:t.map(t=>(0,z.jsx)("li",{className:`${iL.overviewGroupLi} ${iL[`level${t.depth}`]} first:mt-2`,children:(0,z.jsx)(is,{href:`${(0,N.AP)(e.link)}#${t.id}`,children:nu(t.text)})},t.id))})]},e.link)})})]},e.name))]})}function i$(e){return(0,z.jsxs)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256"},e),{children:[(0,z.jsx)("path",{fill:"#C12127",d:"M0 256V0h256v256z"}),(0,z.jsx)("path",{fill:"#FFF",d:"M48 48h160v160h-32V80h-48v128H48z"})]}))}function iB(e){return(0,z.jsx)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:(0,z.jsxs)("g",{fill:"#2c8ebb",children:[(0,z.jsx)("path",{d:"M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"}),(0,z.jsx)("path",{d:"M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"})]})}))}function iD(e){return(0,z.jsxs)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:[(0,z.jsx)("path",{fill:"#f8ab00",d:"M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"}),(0,z.jsx)("path",{fill:"#4c4c4c",d:"M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"})]}))}function iH(e){return(0,z.jsxs)("svg",tI(tj({id:"Bun",width:"1.2em",height:"1.2em",viewBox:"0 0 80 70"},e),{children:[(0,z.jsx)("path",{id:"Shadow",d:"M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"}),(0,z.jsxs)("g",{id:"Body",children:[(0,z.jsx)("path",{id:"Background",d:"M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z",style:{fill:"#fbf0df"}}),(0,z.jsx)("path",{id:"Bottom_Shadow","data-name":"Bottom Shadow",d:"M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z",style:{fill:"#f6dece"}}),(0,z.jsx)("path",{id:"Light_Shine","data-name":"Light Shine",d:"M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z",style:{fill:"#fffefc"}}),(0,z.jsx)("path",{id:"Top",d:"M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z",style:{fill:"#ccbea7",fillRule:"evenodd"}}),(0,z.jsx)("path",{id:"Outline",d:"M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"})]}),(0,z.jsxs)("g",{id:"Mouth",children:[(0,z.jsx)("g",{id:"Background-2","data-name":"Background",children:(0,z.jsx)("path",{d:"M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z",style:{fill:"#b71422"}})}),(0,z.jsxs)("g",{id:"Tongue",children:[(0,z.jsx)("path",{id:"Background-3","data-name":"Background",d:"M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z",style:{fill:"#ff6164"}}),(0,z.jsx)("path",{id:"Outline-2","data-name":"Outline",d:"M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"})]}),(0,z.jsx)("path",{id:"Outline-3","data-name":"Outline",d:"M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"})]}),(0,z.jsxs)("g",{id:"Face",children:[(0,z.jsx)("ellipse",{id:"Right_Blush","data-name":"Right Blush",cx:"53.22",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,z.jsx)("ellipse",{id:"Left_Bluch","data-name":"Left Bluch",cx:"22.95",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,z.jsx)("path",{id:"Eyes",d:"M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z",style:{fillRule:"evenodd"}}),(0,z.jsx)("path",{id:"Iris",d:"M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z",style:{fill:"#fff",fillRule:"evenodd"}})]})]}))}function iF(e){if(!(null==e?void 0:e.includes("install")))return e;let t=e.split(" ").filter(e=>!e.startsWith("-")&&!e.startsWith("--")).join(" ");return"yarn install"===t||"bun install"===t?e:e.replace("install","add")}function iW({command:e,additionalTabs:t=[]}){let n;let i={npm:(0,z.jsx)(i$,{}),yarn:(0,z.jsx)(iB,{}),pnpm:(0,z.jsx)(iD,{}),bun:(0,z.jsx)(iH,{})};return t.forEach(e=>{i[e.tool]=e.icon}),"string"==typeof e?(n={npm:`npm ${e}`,yarn:`yarn ${e}`,pnpm:`pnpm ${e}`,bun:`bun ${e}`},t.forEach(t=>{n[t.tool]=`${t.tool} ${e}`})):n=e,n.yarn&&(n.yarn=iF(n.yarn)),n.bun&&(n.bun=iF(n.bun)),(0,z.jsx)(iJ,{groupId:"package.manager",values:Object.entries(n).map(([e])=>(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:15},children:[i[e],(0,z.jsx)("span",{style:{marginLeft:6,marginBottom:2},children:e})]},e)),children:Object.entries(n).map(([e,t])=>(0,z.jsx)(iQ,{children:(0,z.jsx)(nJ,{children:(0,z.jsx)(nK,{className:"language-js",codeHighlighter:"prism",children:t})})},e))})}var iq={pagerLink:"pager-link_9b9a7",title:"title_9b9a7",next:"next_9b9a7",desc:"desc_9b9a7"};function iU(e){let{type:t,text:n,href:i}=e,{prevPageText:r="Previous Page",nextPageText:a="Next page"}=tT(),o="prev"===t?iq.pagerLink:`${iq.pagerLink} ${iq.next}`;return(0,z.jsxs)(is,{href:i,className:o,children:[(0,z.jsx)("span",{className:iq.desc,children:"prev"===t?r:a}),(0,z.jsx)("span",{className:iq.title,children:n})]})}var iV={scrollToTop:"scroll-to-top_1a167",entered:"entered_1a167"};function iG(){let[e,t]=(0,T.useState)(!1),n=()=>{t((window.scrollY||document.documentElement.scrollTop)>0)};return(0,T.useEffect)(()=>{window.addEventListener("scroll",n)},[]),(0,z.jsx)("button",{className:`${iV.scrollToTop} ${e?iV.entered:""}`,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},children:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,z.jsx)("path",{fillRule:"evenodd",d:"M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"})})})}var iZ={mask:"mask_6e282",modal:"modal_6e282",inputForm:"inputForm_6e282",input:"input_6e282",close:"close_6e282",searchHits:"searchHits_6e282",groupTitle:"groupTitle_6e282",navSearchButton:"navSearchButton_6e282",searchWord:"searchWord_6e282",suggestItem:"suggestItem_6e282",suggestItemContainer:"suggestItemContainer_6e282",contentWrapper:"contentWrapper_6e282",mark:"mark_6e282",titleForContent:"titleForContent_6e282",actionIcon:"actionIcon_6e282",current:"current_6e282",tabClassName:"tabClassName_6e282",mobileNavSearchButton:"mobileNavSearchButton_6e282"},iY={container:"container_fa768",tabList:"tab-list_fa768",tab:"tab_fa768",notSelected:"not-selected_fa768",selected:"selected_fa768",noScrollbar:"no-scrollbar_fa768"},iK=e=>{var t;return(t=e)&&"object"==typeof t&&"label"in t?e.label||e.value:e},iJ=(0,T.forwardRef)((e,t)=>{let{values:n,defaultValue:i,onChange:r,children:a,groupId:o,tabPosition:l="left",tabContainerClassName:s}=e,d=T.Children.toArray(a).filter(e=>!("string"==typeof e&&""===e.trim())),c=n||[];0===c.length&&(c=T.Children.map(d,e=>{var t,n,i;return(0,T.isValidElement)(e)?{label:null==(t=e.props)?void 0:t.label,value:(null==(n=e.props)?void 0:n.value)||(null==(i=e.props)?void 0:i.label)}:{label:void 0,value:void 0}}));let{tabData:u,setTabData:h}=(0,T.useContext)(nb),[p,m]=(0,T.useState)(()=>void 0===i?0:c.findIndex(e=>"string"==typeof e?e===i:!!e&&"object"==typeof e&&"value"in e&&e.value===i)),[f,g]=nt(`rspress.tabs.${o}`,p),x=(0,T.useMemo)(()=>{if(o)return void 0!==u[o]?u[o]:Number.parseInt(f);return p},[u[o]]);(0,T.useEffect)(()=>{if(o){let e=Number.parseInt(f);x!==e&&h(tI(tj({},u),{[o]:e}))}},[f]);let v=o?x:p;return(0,z.jsxs)("div",{className:iY.container,ref:t,children:[(0,z.jsx)("div",{className:s,children:c.length?(0,z.jsx)("div",{className:`${iY.tabList} ${iY.noScrollbar}`,style:{justifyContent:"center"===l?"center":"flex-start"},children:c.map((e,t)=>(0,z.jsx)("div",{className:`${iY.tab} ${v===t?iY.selected:iY.notSelected}`,onClick:()=>{null==r||r(t),o?(h(tI(tj({},u),{[o]:t})),g(t)):m(t)},children:iK(e)},t))}):null}),(0,z.jsx)("div",{children:T.Children.toArray(d)[v]})]})});function iQ(e){var{children:t}=e,n=tP(e,["children"]);return(0,z.jsx)("div",tI(tj({},n),{className:"rounded px-2",children:t}))}function iX({query:e}){let{searchNoResultsText:t="No results for",searchSuggestedQueryText:n="Please try again with a different keyword"}=tT();return(0,z.jsxs)("div",{className:"flex flex-col items-center pt-8 pb-2",children:[(0,z.jsx)(nx,{icon:th,className:"mb-4 opacity-80"}),(0,z.jsxs)("p",{className:"mb-2",children:[t," ",(0,z.jsxs)("b",{children:['"',e,'"']})]}),(0,z.jsx)("p",{children:n})]})}var i0={title:e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M4 4a2 2 0 0 1 2-2h8a1 1 0 0 1 .707.293l5 5A1 1 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4zm13.586 4L14 4.414V8h3.586zM12 4H6v16h12V10h-5a1 1 0 0 1-1-1V4z"})}),header:e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M28 12v-2h-6V4h-2v6h-8V4h-2v6H4v2h6v8H4v2h6v6h2v-6h8v6h2v-6h6v-2h-6v-8Zm-8 8h-8v-8h8Z"})}),content:e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:[(0,z.jsx)("circle",{cx:22,cy:24,r:2,fill:"currentColor"}),(0,z.jsx)("path",{fill:"none",d:"M22 28a4 4 0 1 1 4-4 4.004 4.004 0 0 1-4 4Zm0-6a2 2 0 1 0 2 2 2.003 2.003 0 0 0-2-2Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M29.777 23.479A8.64 8.64 0 0 0 22 18a8.64 8.64 0 0 0-7.777 5.479L14 24l.223.521A8.64 8.64 0 0 0 22 30a8.64 8.64 0 0 0 7.777-5.479L30 24ZM22 28a4 4 0 1 1 4-4 4.005 4.005 0 0 1-4 4Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M12 28H8V4h8v6a2.006 2.006 0 0 0 2 2h6v4h2v-6a.91.91 0 0 0-.3-.7l-7-7A.909.909 0 0 0 18 2H8a2.006 2.006 0 0 0-2 2v24a2.006 2.006 0 0 0 2 2h4Zm6-23.6 5.6 5.6H18Z"})]})};function i1({suggestion:e,closeSearch:t,isCurrent:n,setCurrentSuggestionIndex:i,inCurrentDocIndex:r,scrollTo:a}){var o,l;let s=i0[e.type],d=r&&!(0,F.yv)()?tY(e.link):e.link,c=(0,T.useRef)(null);n&&a(null==(o=null==c?void 0:c.current)?void 0:o.offsetTop,null==(l=null==c?void 0:c.current)?void 0:l.offsetHeight);let u=(e,t)=>{let n=[],i=0;for(let l of t){var r,a,o;let{start:t,length:s}=l,d=e.slice(i,t);let c=(r=e,a=t,o=s,function(e,t,n){let i="",r=0,a=e.length;for(let o=0;o0+n);o++){;r>t&&(i+=e.charAt(o))}return i}(r.slice(a),0,o));n.push(d),n.push((0,z.jsx)("span",{className:iZ.mark,children:c},t)),i=t+c.length}return i{if("header"===e.type||"title"===e.type){let{header:t,highlightInfoList:n}=e;return(0,z.jsx)("div",{className:"font-medium",children:u(t,n)})}return(0,z.jsx)("div",{className:"font-medium",children:e.header})})();break;case"content":h=(0,z.jsxs)(z.Fragment,{children:[(()=>{if("content"!==e.type)return(0,z.jsx)("div",{});let{statement:t,highlightInfoList:n}=e;return(0,z.jsx)("div",{className:"text-sm text-gray-light w-full",children:u(t,n)})})(),(0,z.jsx)("p",{className:iZ.titleForContent,children:e.title})]})}return(0,z.jsx)("li",{className:`${iZ.suggestItem} ${n?iZ.current:""}`,onMouseEnter:i,ref:c,children:(0,z.jsx)("a",{href:d,onClick:e=>{t(),e.stopPropagation()},target:r?"_self":"_blank",children:(0,z.jsxs)("div",{className:iZ.suggestItemContainer,children:[(0,z.jsx)("div",{className:iZ.hitIcon,children:(0,z.jsx)(nx,{icon:s})}),(0,z.jsx)("div",{className:iZ.contentWrapper,children:(0,z.jsx)("span",{children:h})}),(0,z.jsx)("div",{className:iZ.actionIcon,children:(0,z.jsx)(nx,{icon:tp})})]})})},e.link)}var i2={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter",SEARCH:"KeyK",ESC:"Escape"},i3=e=>{let t=(0,T.useRef)(e);return t.current=e,(0,T.useCallback)((0,tl.Z)((...e)=>t.current(...e),150),[])};function i4({focused:e,setFocused:t}){var n,i,r,a;let[o,l]=(0,T.useState)(""),[s,d]=(0,T.useState)([]),c=(0,T.useRef)(null),[u,h]=(0,T.useState)(!0),[p,m]=(0,T.useState)(!1),[f,g]=(0,T.useState)(0),[x,v]=(0,T.useState)(0),b=(0,T.useRef)(null),y=(0,T.useRef)(null),w=(0,T.useRef)(null),k=(0,T.useRef)(null),[j,I]=(0,T.useState)(!1),P=(e,t)=>{var n,i,r,a,o;if(j){let l=e+t-(null==(n=null==w?void 0:w.current)?void 0:n.offsetHeight)-(1===s.length?50:-10);l>(null==(i=null==w?void 0:w.current)?void 0:i.scrollTop)&&(null==(r=null==w?void 0:w.current)||r.scrollTo({top:l}));let d=1===s.length?e-70:e-10;d<(null==(a=null==w?void 0:w.current)?void 0:a.scrollTop)&&(null==(o=null==w?void 0:w.current)||o.scrollTo({top:d}))}},{siteData:S,page:{lang:E,version:N}}=(0,_.Vi)(),{sidebar:A,searchPlaceholderText:O="Search Docs"}=tT(),{search:M,title:L}=S,R=M&&"remote"!==M.mode&&M.versioned,$=[{group:L,result:[],renderType:"default"}],B=null!=(i=null==(n=s[f])?void 0:n.result)?i:[],D=null!=(a=null==(r=s[f])?void 0:r.renderType)?a:"default",H=e=>tO(A,e).group;function W(){return tz(this,null,function*(){var e,t;if(!1===M)return;let n={currentLang:E,currentVersion:N,extractGroupName:H},i=new t6(tj(tj({indexName:L},M),n));b.current=i,y.current=n,yield b.current.init(),h(!1);let r=null==(e=c.current)?void 0:e.value;r&&(d((yield null==(t=b.current)?void 0:t.match(r))||$),m(!1))})}let q=()=>{t(!1),g(0),v(0)};(0,T.useEffect)(()=>{let n=n=>{switch(n.code){case i2.SEARCH:(n.ctrlKey||n.metaKey)&&(n.preventDefault(),t(!e));break;case i2.ARROW_DOWN:e&&(n.preventDefault(),B&&"default"===D&&(I(!0),v((x+1)%B.length)));break;case i2.ARROW_UP:if(e&&(n.preventDefault(),"default"===D)){let e=B.length;I(!0),v((x-1+e)%e)}break;case i2.ENTER:if(x>=0&&"default"===D){let e=[].concat(...Object.values(V(B)))[x];0===f?window.location.href=(0,F.yv)()?e.link:tY(e.link):window.open(e.link),q()}break;case i2.ESC:q()}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[v,t,e,f,B,x]),(0,T.useEffect)(()=>{e?(d($),!b.current&&W()):l("")},[e]),(0,T.useEffect)(()=>{var e;let{currentLang:t,currentVersion:n}=null!=(e=y.current)?e:{},i=E!==t,r=R&&N!==n;!u&&(i||r)&&W()},[E,N,R]);let U=i3(e=>tz(this,null,function*(){var t,n;let i=e;if(l(i),M&&"remote"===M.mode&&M.searchLoading&&m(!0),i){let e=[];if("beforeSearch"in C){let e=yield C.beforeSearch(i);e&&(i=e)}let r=yield null==(t=b.current)?void 0:t.match(i);if(r&&e.push(...r),"onSearch"in C){let t=yield C.onSearch(i,e);t&&e.push(...t.map(e=>tj({renderType:"custom"},e)))}"afterSearch"in C&&(yield C.afterSearch(i,e)),(null==(n=c.current)?void 0:n.value)===i&&(d(e||$),m(!1))}})),V=e=>(0,ts.Z)(e,"group"),G=(e,t,n)=>{if(n)return(0,z.jsx)("div",{className:"flex flex-col items-center",children:(0,z.jsx)(nx,{icon:tu,className:"m-8 opacity-80"})});if(0===e.length&&!u)return(0,z.jsx)(iX,{query:t});let i=V(e),r=-1;return(0,z.jsx)("ul",{className:iZ.suggestList,children:Object.keys(i).map(e=>{let t=i[e]||[];return(0,z.jsx)("li",{children:(0,z.jsx)("ul",{className:"pb-2",children:t.map(e=>{let t=++r;return(0,z.jsx)(i1,{suggestion:e,isCurrent:t===x,setCurrentSuggestionIndex:()=>{I(!1),v(t)},closeSearch:()=>{q()},inCurrentDocIndex:0===f,scrollTo:P},`${e.title}-${t}`)})})},e)})})};return(0,z.jsx)(z.Fragment,{children:e&&(0,er.createPortal)((0,z.jsx)("div",{className:iZ.mask,onClick:()=>{q()},children:(0,z.jsxs)("div",{className:`${iZ.modal}`,onClick:e=>{t(!0),e.stopPropagation()},children:[(0,z.jsxs)("div",{className:"flex items-center",children:[(0,z.jsxs)("div",{className:iZ.inputForm,children:[(0,z.jsx)("label",{children:(0,z.jsx)(nx,{icon:to})}),(0,z.jsx)("input",{className:iZ.input,ref:c,placeholder:O,"aria-label":"Search",autoComplete:"off",autoFocus:!0,onChange:e=>U(e.target.value)}),(0,z.jsx)("label",{children:(0,z.jsx)(nx,{icon:tc,className:iZ.close,onClick:e=>{c.current&&(e.stopPropagation(),o?(c.current.value="",l("")):q())}})})]}),(0,z.jsx)("h2",{className:"text-brand ml-2 sm:hidden cursor-pointer",onClick:e=>{e.stopPropagation(),q()},children:"Cancel"})]}),o&&!u?(0,z.jsx)("div",{className:`${iZ.searchHits} rspress-scrollbar`,ref:w,children:((e,t,n)=>{if(1===e.length){let t=e[0].result;return 0!==t.length||n?(0,z.jsx)("div",{ref:k,children:G(t,o,n)}):(0,z.jsx)(iX,{query:o})}let i=e.map(e=>t&&"remote"===t.mode?tJ(t.searchIndexes||[]).find(t=>t.value===e.group).label:e.group);return(0,z.jsx)(iJ,{values:i,tabContainerClassName:iZ.tabClassName,onChange:e=>{g(e),v(0)},ref:k,children:e.map(e=>(0,z.jsxs)(iQ,{children:["default"===e.renderType&&G(e.result,o,n),"custom"===e.renderType&&C.render(e.result)]},e.group))})})(s,M,p)}):null]})}),document.getElementById("search-container"))})}function i5(){let[e,t]=(0,T.useState)(!1),[n,i]=(0,T.useState)(null),{searchPlaceholderText:r="Search Docs"}=tT();return(0,T.useEffect)(()=>{i(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?"\u2318":"Ctrl")},[]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:`rspress-nav-search-button ${iZ.navSearchButton}`,onClick:()=>t(!0),children:(0,z.jsxs)("button",{children:[(0,z.jsx)(nx,{icon:to,width:"18",height:"18"}),(0,z.jsx)("p",{className:iZ.searchWord,children:r}),(0,z.jsxs)("div",{style:{opacity:n?1:0},children:[(0,z.jsx)("span",{children:n}),(0,z.jsx)("span",{children:"K"})]})]})}),(0,z.jsx)("div",{className:iZ.mobileNavSearchButton,onClick:()=>t(!0),children:(0,z.jsx)(nx,{icon:to})}),(0,z.jsx)(i4,{focused:e,setFocused:t})]})}var i6={navTitleMask:"navTitleMask_71eca",sidebar:"sidebar_71eca",sidebarContent:"sidebarContent_71eca",open:"open_71eca",menuLink:"menuLink_71eca",menuItem:"menuItem_71eca",collapseContainer:"collapseContainer_71eca",menuItemActive:"menuItemActive_71eca"};function i7(e){let{depth:t,dividerType:n}=e;return(0,z.jsx)("div",{className:`${"dashed"===n?"border-dashed":"border-solid"} border-t border-divider-light my-3`,style:{marginLeft:0===t?0:"18px"}})}function i8(e){var t;let{item:n,depth:i=0,activeMatcher:r,id:a,setSidebarData:o}=e,l=(0,O.s0)(),s=(0,T.useRef)(null),d=(0,T.useRef)(null),c=(0,T.useRef)(null),u=(0,T.useRef)(!0),h=(0,T.useRef)(n.collapsed),p=n.link&&r(n.link),{collapsed:m,collapsible:f=!0}=n,g=(0,z.jsx)("div",{style:{cursor:"pointer",transition:"transform 0.2s ease-out",transform:m?"rotate(0deg)":"rotate(90deg)"},children:(0,z.jsx)(nx,{icon:Q})});(0,T.useEffect)(()=>{if(u.current||!s.current||!c.current)return;d.current&&clearTimeout(d.current);let e=s.current,t=c.current,n=t.clientHeight+4;m?(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.5s",t.style.opacity="0",d.current=setTimeout(()=>{s.current&&(s.current.style.maxHeight="0px")},0)):(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.3s",t.style.opacity="1",d.current=setTimeout(()=>{s.current&&s.current.style.removeProperty("max-height")},300))},[m]),(0,T.useEffect)(()=>{u.current=!1},[]);let x=e=>{e.stopPropagation(),o(e=>{let t=[...e],n=a.split("-").map(Number),i=t[n.shift()];for(let e of n)i=i.items[e];return"items"in i&&(i.collapsed=!i.collapsed),t})};return(0,z.jsxs)("section",{className:"mt-0.5 block","data-context":n.context,style:{marginLeft:0===i?0:"18px"},children:[(0,z.jsxs)("div",{className:`flex justify-between items-center ${p?i6.menuItemActive:i6.menuItem}`,onMouseEnter:()=>n.link&&e.preloadLink(n.link),onClick:e=>{n.link&&l((0,N.pJ)((0,N.AP)(n.link))),f&&x(e)},style:{borderRadius:0===i?"0 var(--rp-radius) var(--rp-radius) 0":void 0,cursor:f||n.link?"pointer":"normal"},children:[(0,z.jsxs)("h2",{className:"py-2 px-3 text-sm font-medium flex",style:tj({},0===i?rr:{}),children:[(0,z.jsx)(ru,{tag:n.tag}),(0,z.jsx)("span",{className:"flex-center",children:nu(n.text)})]}),f&&(0,z.jsx)("div",{className:`${i6.collapseContainer} p-2 rounded-xl`,onClick:x,children:g})]}),(0,z.jsx)("div",{ref:s,className:"transition-all duration-300 ease-in-out",style:{overflow:"hidden",maxHeight:h.current?0:void 0},children:(0,z.jsx)("div",{ref:c,className:"rspress-sidebar-group transition-opacity duration-500 ease-in-out",style:{opacity:h.current?0:1,marginLeft:0===i?"12px":0},children:null==(t=null==n?void 0:n.items)?void 0:t.map((t,n)=>"dividerType"in t?(0,z.jsx)(i7,{depth:i+1,dividerType:t.dividerType},n):(0,z.jsx)("div",{"data-context":t.context,children:(0,z.jsx)(re,tI(tj({},e),{item:t,depth:i+1,id:`${a}-${n}`,preloadLink:e.preloadLink}))},n))})})]},a)}var i9=e=>e.replace(/\.(mdx?)$/,"");function re(e){let{item:t,depth:n=0,activeMatcher:i,id:r,setSidebarData:a}=e,o="link"in t&&t.link&&i(t.link),{page:l}=(0,_.Vi)(),s=(0,T.useRef)(null),d=(0,T.useRef)(t.text),c=function(){let[,e]=(0,T.useState)(0);return()=>{e(e=>e+1)}}();return((0,T.useEffect)(()=>{var e;o&&(null==(e=s.current)||e.scrollIntoView({block:"center"}))},[]),!(0,F.yv)()&&t._fileKey===i9(l.pagePath)&&l.title&&(d.current=l.title),(0,T.useEffect)(()=>{if(t.text!==d.current)d.current=t.text,c()},[t.text]),"items"in t)?(0,z.jsx)(i8,{id:r,item:t,depth:n,activeMatcher:i,collapsed:t.collapsed,setSidebarData:a,preloadLink:e.preloadLink},`${t.text}-${r}`):(0,z.jsx)(is,{href:(0,N.AP)(t.link),className:i6.menuLink,children:(0,z.jsxs)("div",{ref:s,onMouseEnter:()=>e.preloadLink(t.link),className:`${o?i6.menuItemActive:i6.menuItem} mt-0.5 py-2 px-3 font-medium flex`,style:tj({fontSize:0===n?"14px":"13px",marginLeft:0===n?0:"18px",borderRadius:"0 var(--rp-radius) var(--rp-radius) 0"},0===n?rr:{}),children:[(0,z.jsx)(ru,{tag:t.tag}),(0,z.jsx)("span",{children:nu(d.current)})]})})}function rt({sectionHeaderText:e,tag:t}){return(0,z.jsxs)("div",{className:"rspress-sidebar-section-header",children:[(0,z.jsx)(ru,{tag:t}),(0,z.jsx)("span",{children:nu(e)})]})}var rn=e=>"dividerType"in e,ri=e=>"sectionHeaderText"in e,rr={fontSize:"14px",paddingLeft:"24px",fontWeight:"bold"},ra=new WeakMap;function ro(e){let{isSidebarOpen:t,beforeSidebar:n,afterSidebar:i,uiSwitch:r}=e,{pathname:a}=(0,O.TH)(),{items:o}=tM(),[l,s]=(0,T.useState)(()=>o.filter(Boolean).flat()),d=tT(),c=decodeURIComponent(a),u=(0,F.Kw)(d.langRoutePrefix||"");(0,T.useEffect)(()=>{F._f&&(t?(E=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=E||"")},[t]),(0,T.useEffect)(()=>{if(o===l)return;ra=new WeakMap;let e=t=>ra.has(t)?ra.get(t):"link"in t&&t.link&&p(t.link)||"items"in t&&t.items.some(t=>e(t))?(ra.set(t,!0),!0):(ra.set(t,!1),!1),t=n=>{"items"in n&&(n.items.forEach(t),e(n)&&(n.collapsed=!1))},n=o.filter(Boolean).flat();n.forEach(t),s(n)},[o,c]);let h=e=>e.replace(u,""),p=e=>na((0,N.E9)(h(c)),h(e),!0),m=e=>{let t=(0,M.fp)(eV.routes,e);if(null==t?void 0:t.length){let{route:e}=t[0];e.preload()}};return(0,z.jsxs)("aside",{className:`${i6.sidebar} rspress-sidebar ${t?i6.open:""}`,children:[r.showNavbar?(0,z.jsx)("div",{className:i6.navTitleMask,children:(0,z.jsx)(iA,{})}):null,(0,z.jsx)("div",{className:`rspress-scrollbar ${i6.sidebarContent}`,children:(0,z.jsxs)("nav",{className:"pb-2",children:[n,l.map((e,t)=>{var n;return rn(e)?(0,z.jsx)(i7,{depth:0,dividerType:e.dividerType},t):ri(e)?(0,z.jsx)(rt,{sectionHeaderText:e.sectionHeaderText,tag:e.tag},t):(0,z.jsx)(re,{id:String(t),item:e,depth:0,activeMatcher:p,collapsed:null==(n=e.collapsed)||n,setSidebarData:s,preloadLink:m},t)}),i]})})]})}var rl="sourceCode_bf1b0";function rs(e){let{href:t,platform:n="github"}=e,{sourceCodeText:i="Source"}=tT();return(0,z.jsx)("div",{className:`inline-block rounded border border-solid border-gray-light-3 dark:border-divider text-gray-400 ${rl}`,children:(0,z.jsxs)("a",{href:t,target:"_blank",className:"flex items-center content-center transition-all duration-300 text-xs block px-2 py-1 ",children:[(0,z.jsx)("span",{className:"mr-2 inline-flex w-4 h-4",children:(0,z.jsx)(nx,{icon:"gitlab"===n?tf:tm})}),(0,z.jsx)("span",{children:i})]})})}var rd="rspressSteps_38f64";function rc({children:e}){return(0,z.jsx)("div",{className:`ml-4 mb-11 border-l pl-6 ${rd} [counter-reset:step]`,children:e})}var ru=({tag:e})=>e?e.trim().startsWith("(0,z.jsx)("li",{children:(0,z.jsx)("a",{href:`#${e.id}`,className:"rspress-toc-link sm:text-normal text-sm",style:{marginLeft:(e.depth-2)*12},onClick:n=>{n.preventDefault(),window.location.hash=e.id;let i=document.getElementById(e.id);i&&tH(i,!1),null==t||t(e)},children:(0,z.jsx)("span",{className:"rspress-toc-link-text block",children:nu(e.text)})})},e.id);function rp({onItemClick:e}){let{page:t}=(0,_.Vi)();return(0,z.jsx)("ul",{children:t.toc.map(t=>(0,z.jsx)(rh,{header:t,onItemClick:e},t.id))})}var rm={Layout:nj,NotFoundLayout:tA,HomeLayout:nI,setup:tW}},924:function(e){"use strict";e.exports=JSON.parse('{"AElig":"\xc6","AMP":"&","Aacute":"\xc1","Acirc":"\xc2","Agrave":"\xc0","Aring":"\xc5","Atilde":"\xc3","Auml":"\xc4","COPY":"\xa9","Ccedil":"\xc7","ETH":"\xd0","Eacute":"\xc9","Ecirc":"\xca","Egrave":"\xc8","Euml":"\xcb","GT":">","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},3222:function(e){"use strict";e.exports=JSON.parse('{"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"}')},8606:function(e){"use strict";e.exports=JSON.parse('["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]')}}]); \ No newline at end of file +/*! For license information please see 2970.43a165d0.js.LICENSE.txt */ +(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["2970"],{835:function(e,t,n){"use strict";n.d(t,{Jr:function(){return s},Ni:function(){return o},R0:function(){return a},Vi:function(){return l},aw:function(){return d},n_:function(){return c}});var i=n(2363),r=n(1850);let a=(0,i.createContext)({}),o=(0,i.createContext)({});function l(){return(0,i.useContext)(a).data}function s(){return(0,i.useContext)(a).data.page.lang||""}function d(){return(0,i.useContext)(a).data.page.version||""}function c(e){let[t,n]=(0,i.useState)(e);return(0,i.useLayoutEffect)(()=>{document.startViewTransition&&t!==e?document.startViewTransition(()=>{(0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent"))}):((0,r.flushSync)(()=>{n(e)}),window.dispatchEvent(new Event("RspressReloadContent")))},[e]),t}},7833:function(e,t,n){"use strict";n.d(t,{AP:function(){return d},E9:function(){return l},Tm:function(){return a},i6:function(){return c},pJ:function(){return o},pV:function(){return s}});var i=n(6780),r=n(33);function a(e){return decodeURIComponent(e).replace(/\.html$/,"").replace(/\/index$/,"/")}function o(e="/"){return(0,r.pJ)(e,i.Z.base)}function l(e){return(0,r.E9)(e,i.Z.base)}function s(e,t){return o(d((0,r.lm)(e)))===o(d((0,r.lm)(t)))}function d(e){let t=!!i.Z?.route?.cleanUrls;return(0,r.yc)(e,t)}function c(e){return!(0,r.yv)()||(0,r.xf)(e)||(0,r.pZ)(e)||e.startsWith("//")||!e.startsWith("/")?e:o(e)}},429:function(e,t){"use strict";t.parse=function(e){for(var t,n=[],i=String(e||""),r=i.indexOf(","),a=0,o=!1;!o;)-1===r&&(r=i.length,o=!0),((t=i.slice(a,r).trim())||!o)&&n.push(t),a=r+1,r=i.indexOf(",",a);return n};function n(e,t){var n=t||{},i=!1===n.padLeft?"":" ",r=n.padRight?" ":"";return""===e[e.length-1]&&(e=e.concat("")),e.join(r+","+i).trim()}},9522:function(e,t,n){"use strict";var i=n(8456),r={"text/plain":"Text","text/html":"Url",default:"Text"};e.exports=function(e,t){var n,a,o,l,s,d,c,u,h=!1;!t&&(t={}),o=t.debug||!1;try{if(s=i(),d=document.createRange(),c=document.getSelection(),(u=document.createElement("span")).textContent=e,u.ariaHidden="true",u.style.all="unset",u.style.position="fixed",u.style.top=0,u.style.clip="rect(0, 0, 0, 0)",u.style.whiteSpace="pre",u.style.webkitUserSelect="text",u.style.MozUserSelect="text",u.style.msUserSelect="text",u.style.userSelect="text",u.addEventListener("copy",function(n){if(n.stopPropagation(),t.format){if(n.preventDefault(),void 0===n.clipboardData){o&&console.warn("unable to use e.clipboardData"),o&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var i=r[t.format]||r.default;window.clipboardData.setData(i,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e)}t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(u),d.selectNodeContents(u),c.addRange(d),!document.execCommand("copy"))throw Error("copy command was unsuccessful");h=!0}catch(i){o&&console.error("unable to copy using execCommand: ",i),o&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),h=!0}catch(i){;o&&console.error("unable to copy using clipboardData: ",i),o&&console.error("falling back to prompt"),n="message"in t?t.message:"Copy to clipboard: #{key}, Enter",a=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C",l=n.replace(/#{\s*key\s*}/g,a),window.prompt(l,e)}}finally{c&&("function"==typeof c.removeRange?c.removeRange(d):c.removeAllRanges()),u&&document.body.removeChild(u),s()}return h}},5653:function(e){"use strict";var t,n;let i;t=function e(t){let n;function i(e,t){let n=t?t.id:e&&e.id;this.id=n||0===n?n:_++,this.init(e,t),l(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)}),l(this,"length",function(){return this.index.length})}function r(e,t,n,i){return this.u!==this.g&&(this.o=this.o.concat(n),this.u++,i&&this.o.length>=i&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(t,this.o),this.F&&this.F(this.o))),this}function a(e,t){let n=e.length,i=y(t),r=[];for(let a=0,o=0;a=o&&((e=(e=e[l-(r+.5>>0)])[n]||(e[n]=[]))[e.length]=i),r)}function u(e,t){if(e){let n=Object.keys(e);for(let i=0,r=n.length;i(e=e.length-t.length)?1:e?-1:0}function m(e,t){return e=e[n],e<(t=t[n])?-1:e>t?1:0}function f(e,t){let i=n.length;for(let r=0;rt?1:0}function g(e,t,n){return e?{page:e,next:t?""+t:null,result:n}:n}function x(e,t,n,i,r,a,o){let l,s=[];if(!0===n){n="0";var d=""}else d=n&&n.split(":");let c=e.length;if(1o&&(d=0),(l=(d=d||0)+t)=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:e,content:t}),this.c[o]=""+this.C,n&&n(),this;if(!r){if(this.async&&"function"!=typeof importScripts){let r=this;return(o=new Promise(function(n){setTimeout(function(){r.add(e,t,null,i,!0),r=null,n()})}),n)?(o.then(n),this):o}if(n)return this.add(e,t,null,i,!0),n(),this}if(!(t=this.encode(t)).length)return this;r=y(n=this.f)?n(t):t.split(this.split),this.filter&&(r=a(r,this.filter));let p=I();p._ctx=I();let m=r.length,f=this.threshold,g=this.depth,x=this.b,v=this.i,b=this.D;for(let t=0;th;n--)c(v,p,u=l.substring(h,n),e,t,d,f,x-1)}break;default:if(s=c(v,p,l,e,1,d,f,x-1),g&&1=f)for(s=p._ctx[l]||(p._ctx[l]=I()),l=this.h[l]||(this.h[l]=j(x-(f||0))),0>(d=t-g)&&(d=0),(u=t+g+1)>m&&(u=m);dr;n--)i=a[n-1],a[n]=i,t[i]=n;a[r]=e,t[e]=r}}}return t},e}();return i}(function(){let e={},t="undefined"!=typeof Blob&&"undefined"!=typeof URL&&URL.createObjectURL;return function(n,i,r,a,o){return r=t?URL.createObjectURL(new Blob(["("+r.toString()+")()"],{type:"text/javascript"})):n+".min.js",e[n+="-"+i]||(e[n]=[]),e[n][o]=new Worker(r),e[n][o].onmessage=a,e[n][o]}}()),n=this,(i=n.define)&&i.amd?i([],function(){return t}):(i=n.modules)?i["FlexSearch".toLowerCase()]=t:e.exports=t},3451:function(e){"use strict";e.exports=function(e,n){for(var i,r,a,o=e||"",l=n||"div",s={},d=0;d-1}var o=["itemScope"];function l(t,n,i,r){void 0===r&&(r=null);var a=i[t],o=i._;return a?e.createElement(a,n,r):o?o(t,n,r):e.createElement(t,n,r)}return function(e,i){if(void 0===i&&(i={}),"string"!=typeof e)throw TypeError("Expected HTML string");var a=document.createElement("div");a.innerHTML=e.trim();var o=Array.from(a.childNodes).map(function(e,a){return function e(i,a,o){var s,d,c,u,h=o.transform||{},p=o.preserveAttributes||[],m=o.dangerouslySetChildren||["style"],f=h._;if(8===i.nodeType)return null;if(3===i.nodeType){var g=i.textContent;return f?f(g):g}for(var x={},v=i.attributes,b=0;b1){var r,o=(r=i[0].trim(),/^-ms-/.test(r)&&(r=r.substr(1)),r.startsWith("--")?r:t(r)),l=(n=i.slice(1).join(":").trim(),/^\d+$/.test(n)?Number(n):n.replace(/'/g,'"'));a[o]=l}}),a);else{var l=d[n],h=""===l||String(l).toLowerCase()===i.toLowerCase();e[o.name]=o.isBoolean?h:l}return e},{})),k=Array.from(i.childNodes).map(function(t,i){return n.indexOf(y)>-1&&3===t.nodeType&&(t.textContent=t.textContent.trim(),""===t.textContent)?null:e(t,a+"."+i,o)}).filter(Boolean);if(m.indexOf(y)>-1){var j=i.innerHTML;return j&&("style"!==y&&"script"!==y&&(j=j.replace(/"/g,""")),w.dangerouslySetInnerHTML={__html:j.trim()}),l(y,w,h)}return l(y,w,h,0===k.length?null:k)}(e,String(a),i)}).filter(Boolean);return 1===o.length?o[0]:o}},e.exports=r(n(2363))},4546:function(e){"use strict";e.exports=function(e,t,n,i,r,a,o,l){if(!e){var s;if(void 0===t)s=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,i,r,a,o,l],c=0;(s=Error(t.replace(/%s/g,function(){return d[c++]}))).name="Invariant Violation"}throw s.framesToPop=1,s}}},4761:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},9975:function(e,t,n){"use strict";var i=n(4761),r=n(7525);e.exports=function(e){return i(e)||r(e)}},7525:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},2201:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},7841:function(e){var t,n;t=0,n=function(){var e,t,n,i={};i.version="0.2.0";var r=i.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
      '};function a(e,t,n){return en?n:e}function o(e){return(-1+e)*100}i.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},i.status=null,i.set=function(e){var t=i.isStarted();e=a(e,r.minimum,1),i.status=1===e?null:e;var n=i.render(!t),o=n.querySelector(r.barSelector),d=r.speed,c=r.easing;return n.offsetWidth,l(function(t){""===r.positionUsing&&(r.positionUsing=i.getPositioningCSS()),s(o,function(e,t,n){var i;if("translate3d"===r.positionUsing)i={transform:"translate3d("+(-1+e)*100+"%,0,0)"};else if("translate"===r.positionUsing)i={transform:"translate("+(-1+e)*100+"%,0)"};else i={"margin-left":(-1+e)*100+"%"};return i.transition="all "+t+"ms "+n,i}(e,d,c)),1===e?(s(n,{transition:"none",opacity:1}),n.offsetWidth,setTimeout(function(){s(n,{transition:"all "+d+"ms linear",opacity:0}),setTimeout(function(){i.remove(),t()},d)},d)):setTimeout(t,d)}),this},i.isStarted=function(){return"number"==typeof i.status},i.start=function(){!i.status&&i.set(0);var e=function(){setTimeout(function(){i.status&&(i.trickle(),e())},r.trickleSpeed)};return r.trickle&&e(),this},i.done=function(e){return e||i.status?i.inc(.3+.5*Math.random()).set(1):this},i.inc=function(e){var t=i.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),i.set(t)):i.start()},i.trickle=function(){return i.inc(Math.random()*r.trickleRate)},e=0,t=0,i.promise=function(n){return n&&"resolved"!==n.state()?(0===t&&i.start(),e++,t++,n.always(function(){0==--t?(e=0,i.done()):i.set((e-t)/e)}),this):this},i.render=function(e){if(i.isRendered())return document.getElementById("nprogress");c(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var n,a=t.querySelector(r.barSelector),o=e?"-100":function(e){return(-1+e)*100}(i.status||0),l=document.querySelector(r.parent);return s(a,{transition:"all 0 linear",transform:"translate3d("+o+"%,0,0)"}),!r.showSpinner&&(n=t.querySelector(r.spinnerSelector))&&p(n),l!=document.body&&c(l,"nprogress-custom-parent"),l.appendChild(t),t},i.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&p(e)},i.isRendered=function(){return!!document.getElementById("nprogress")},i.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective" in e?"translate3d":t+"Transform" in e?"translate":"margin"};var l=(n=[],function(e){n.push(e),1==n.length&&!function e(){var t=n.shift();t&&t(e)}()}),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(n,i,r){i=function(n){return t[n=n.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(e,t){return t.toUpperCase()})]||(t[n]=function(t){var n=document.body.style;if(t in n)return t;for(var i,r=e.length,a=t.charAt(0).toUpperCase()+t.slice(1);r--;)if((i=e[r]+a)in n)return i;return t}(n))}(i),n.style[i]=r}return function(e,t){var i,r,a=arguments;if(2==a.length)for(i in t)void 0!==(r=t[i])&&t.hasOwnProperty(i)&&n(e,i,r);else n(e,a[1],a[2])}}();function d(e,t){return("string"==typeof e?e:h(e)).indexOf(" "+t+" ")>=0}function c(e,t){var n=h(e),i=n+t;!d(n,t)&&(e.className=i.substring(1))}function u(e,t){var n,i=h(e);d(e,t)&&(n=i.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function h(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return i},"function"==typeof define&&define.amd?define(n):e.exports=n()},5144:function(e){"use strict";var t;e.exports=function(e){var n,i="&"+e+";";return(t=t||document.createElement("i")).innerHTML=i,(59!==(n=t.textContent).charCodeAt(n.length-1)||"semi"===e)&&n!==i&&n}},2668:function(e,t,n){"use strict";var i=n(924),r=n(3222),a=n(7525),o=n(2201),l=n(9975),s=n(5144);e.exports=function(e,t){var n,a,o={};for(a in!t&&(t={}),h)n=t[a],o[a]=null==n?h[a]:n;return(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start),function(e,t){var n,a,o,h,b,y,w,k,j,I,P,S,E,C,_,N,z,A,T,O=t.additional,M=t.nonTerminated,L=t.text,R=t.reference,$=t.warning,B=t.textContext,D=t.referenceContext,H=t.warningContext,F=t.position,W=t.indent||[],q=e.length,U=0,V=-1,G=F.column||1,Z=F.line||1,Y="",K=[];for("string"==typeof O&&(O=O.charCodeAt(0)),N=J(),k=$?function(e,t){var n=J();n.column+=t,n.offset+=t,$.call(H,v[e],n,e)}:u,U--,q++;++U=55296&&e<=57343||e>1114111}(y=parseInt(h,g[C]))?(k(7,A),y=c(65533)):y in r?(k(6,A),y=r[y]):(I="",function(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(65535&e)==65535||(65535&e)==65534}(y)&&k(6,A),y>65535&&(y-=65536,I+=c(y>>>10|55296),y=56320|1023&y),y=I+c(y))):C!==p&&k(4,A);y?(Q(),N=J(),U=T-1,G+=T-E+1,K.push(y),z=J(),z.offset++,R&&R.call(D,y,{start:N,end:z},e.slice(E-1,T)),N=z):(h=e.slice(E-1,T),Y+=h,G+=h.length,U=T-1)}else 10===b&&(Z++,V++,G=0),b==b?(Y+=c(b),G++):Q();return K.join("");function J(){return{line:Z,column:G,offset:U+(F.offset||0)}}function Q(){Y&&(K.push(Y),L&&L.call(B,Y,{start:N,end:J()}),Y="")}}(e,o)};var d={}.hasOwnProperty,c=String.fromCharCode,u=Function.prototype,h={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",f="decimal",g={};g[m]=16,g[f]=10;var x={};x[p]=l,x[f]=a,x[m]=o;var v={};v[1]="Named character references must be terminated by a semicolon",v[2]="Numeric character references must be terminated by a semicolon",v[3]="Named character references cannot be empty",v[4]="Numeric character references cannot be empty",v[5]="Named character references must be known",v[6]="Numeric character references cannot be disallowed",v[7]="Numeric character references cannot be outside the permissible Unicode range"},3921:function(e,t,n){var i=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,i={},r={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach));k+=w.value.length,w=w.next){;var j,I=w.value;if(n.length>t.length)return;if(!(I instanceof a)){var P=1;if(x){if(!(j=o(y,k,t,g))||j.index>=t.length)break;var S=j.index,E=j.index+j[0].length,C=k;for(C+=w.value.length;S>=C;)C+=(w=w.next).value.length;if(C-=w.value.length,k=C,w.value instanceof a)continue;for(var _=w;_!==n.tail&&(Cc.reach&&(c.reach=T);var O=w.prev;if(z&&(O=s(n,O,z),k+=z.length),function(e,t,n){for(var i=t.next,r=0;r1){var M={cause:u+","+p,reach:T};e(t,n,i,w.prev,k,M),c&&M.reach>c.reach&&(c.reach=M.reach)}}}}}}}(e,d,t,d.head,0),function(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}(d)},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(!!n&&!!n.length)for(var i,a=0;i=n[a++];)i(t)}},Token:a};function a(e,t,n,i){this.type=e,this.content=t,this.alias=n,this.length=0|(i||"").length}function o(e,t,n,i){e.lastIndex=t;var r=e.exec(n);if(r&&i&&r[1]){var a=r[1].length;r.index+=a,r[0]=r[0].slice(a)}return r}e.Prism=r,a.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var i="";return t.forEach(function(t){i+=e(t,n)}),i}var a={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),r.hooks.run("wrap",a);var l="";for(var s in a.attributes)l+=" "+s+'="'+(a.attributes[s]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+""};function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var i=t.next,r={value:n,prev:t,next:i};return t.next=r,i.prev=r,e.length++,r}if(!e.document)return e.addEventListener?(!r.disableWorkerMessageHandler&&e.addEventListener("message",function(t){var n=JSON.parse(t.data),i=n.language,a=n.code,o=n.immediateClose;e.postMessage(r.highlight(a,r.languages[i],i)),o&&e.close()},!1),r):r;var d=r.util.currentScript();function c(){!r.manual&&r.highlightAll()}if(d&&(r.filename=d.src,d.hasAttribute("data-manual")&&(r.manual=!0)),!r.manual){var u=document.readyState;"loading"===u||"interactive"===u&&d&&d.defer?document.addEventListener("DOMContentLoaded",c):window.requestAnimationFrame?window.requestAnimationFrame(c):window.setTimeout(c,16)}return r}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});e.exports&&(e.exports=i),void 0!==n.g&&(n.g.Prism=i)},2504:function(e,t,n){"use strict";var i=n(2265);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,t,n,r,a,o){if(o!==i){var l=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return n.PropTypes=n,n}},3698:function(e,t,n){e.exports=n(2504)()},2265:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2616:function(e,t,n){"use strict";var i=n(2275),r=n(6492),a=n(3811),o="data";e.exports=function(e,t){var n=i(t),h=t,p=a;return n in e.normal?e.property[e.normal[n]]:(n.length>4&&n.slice(0,4)===o&&l.test(t)&&("-"===t.charAt(4)?h=function(e){var t=e.slice(5).replace(s,u);return o+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);return s.test(t)?e:("-"!==(t=t.replace(d,c)).charAt(0)&&(t="-"+t),o+t)}(t),p=r),new p(h,t))};var l=/^data[-\w.:]+$/i,s=/-[a-z]/g,d=/[A-Z]/g;function c(e){return"-"+e.toLowerCase()}function u(e){return e.charAt(1).toUpperCase()}},6093:function(e,t,n){"use strict";var i=n(6399),r=n(9283),a=n(7430),o=n(2376),l=n(5531),s=n(1581);e.exports=i([a,r,o,l,s])},5531:function(e,t,n){"use strict";var i=n(3077),r=n(9469),a=i.booleanish,o=i.number,l=i.spaceSeparated;e.exports=r({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:a,ariaAutoComplete:null,ariaBusy:a,ariaChecked:a,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:l,ariaCurrent:null,ariaDescribedBy:l,ariaDetails:null,ariaDisabled:a,ariaDropEffect:l,ariaErrorMessage:null,ariaExpanded:a,ariaFlowTo:l,ariaGrabbed:a,ariaHasPopup:null,ariaHidden:a,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:l,ariaLevel:o,ariaLive:null,ariaModal:a,ariaMultiLine:a,ariaMultiSelectable:a,ariaOrientation:null,ariaOwns:l,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:a,ariaReadOnly:a,ariaRelevant:null,ariaRequired:a,ariaRoleDescription:l,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:a,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},1581:function(e,t,n){"use strict";var i=n(3077),r=n(9469),a=n(2561),o=i.boolean,l=i.overloadedBoolean,s=i.booleanish,d=i.number,c=i.spaceSeparated,u=i.commaSeparated;e.exports=r({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:a,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:u,acceptCharset:c,accessKey:c,action:null,allow:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:c,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:c,cols:d,colSpan:null,content:null,contentEditable:s,controls:o,controlsList:c,coords:d|u,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:l,draggable:s,encType:null,enterKeyHint:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:c,height:d,hidden:o,high:d,href:null,hrefLang:null,htmlFor:c,httpEquiv:c,id:null,imageSizes:null,imageSrcSet:u,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:c,itemRef:c,itemScope:o,itemType:c,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:o,low:d,manifest:null,max:null,maxLength:d,media:null,method:null,min:null,minLength:d,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforePrint:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextMenu:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:o,optimum:d,pattern:null,ping:c,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:c,required:o,reversed:o,rows:d,rowSpan:d,sandbox:c,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:d,sizes:null,slot:null,span:d,spellCheck:s,src:null,srcDoc:null,srcLang:null,srcSet:u,start:d,step:null,style:null,tabIndex:d,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:s,width:d,wrap:null,align:null,aLink:null,archive:c,axis:null,background:null,bgColor:null,border:d,borderColor:null,bottomMargin:d,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:d,leftMargin:d,link:null,longDesc:null,lowSrc:null,marginHeight:d,marginWidth:d,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:d,rules:null,scheme:null,scrolling:s,standby:null,summary:null,text:null,topMargin:d,valueType:null,version:null,vAlign:null,vLink:null,vSpace:d,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:o,disableRemotePlayback:o,prefix:null,property:null,results:d,security:null,unselectable:null}})},2561:function(e,t,n){"use strict";var i=n(6073);e.exports=function(e,t){return i(e,t.toLowerCase())}},6073:function(e){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},9469:function(e,t,n){"use strict";var i=n(2275),r=n(3673),a=n(6492);e.exports=function(e){var t,n,o=e.space,l=e.mustUseProperty||[],s=e.attributes||{},d=e.properties,c=e.transform,u={},h={};for(t in d)n=new a(t,c(s,t),d[t],o),-1!==l.indexOf(t)&&(n.mustUseProperty=!0),u[t]=n,h[i(t)]=t,h[i(n.attribute)]=t;return new r(u,h,o)}},6492:function(e,t,n){"use strict";var i=n(3811),r=n(3077);e.exports=l,l.prototype=new i,l.prototype.defined=!0;var a=["boolean","booleanish","overloadedBoolean","number","commaSeparated","spaceSeparated","commaOrSpaceSeparated"],o=a.length;function l(e,t,n,l){var s,d=-1;for(function(e,t,n){n&&(e[t]=n)}(this,"space",l),i.call(this,e,t);++d=0||(r[n]=e[n]);return r}var g={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},x={rel:["amphtml","canonical","alternate"]},v={type:["application/ld+json"]},b={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},y=Object.keys(g).map(function(e){return g[e]}),w={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=Object.keys(w).reduce(function(e,t){return e[w[t]]=t,e},{}),j=function(e,t){for(var n=e.length-1;n>=0;n-=1){var i=e[n];if(Object.prototype.hasOwnProperty.call(i,t))return i[t]}return null},I=function(e){var t=j(e,g.TITLE),n=j(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,function(){return t});var i=j(e,"defaultTitle");return t||i||void 0},P=function(e,t){return t.filter(function(t){return void 0!==t[e]}).map(function(t){return t[e]}).reduce(function(e,t){return h({},e,t)},{})},S=function(e,t,n){var i={};return n.filter(function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)}).map(function(t){return t[e]}).reverse().reduce(function(e,n){var r={};n.filter(function(e){for(var n,a=Object.keys(e),o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")},T=function(e){return Object.keys(e).reduce(function(t,n){var i=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+i:i},"")},O=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce(function(t,n){return t[w[n]||n]=e[n],t},t)},M=function(e,t){return t.map(function(t,n){var r,a=((r={key:n})["data-rh"]=!0,r);return Object.keys(t).forEach(function(e){var n=w[e]||e;"innerHTML"===n||"cssText"===n?a.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:a[n]=t[e]}),i.createElement(e,a)})},L=function(e,t,n){switch(e){case g.TITLE:return{toComponent:function(){var e,n,r,a;return n=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,a=O(n,r),[i.createElement(g.TITLE,a,e)]},toString:function(){var i,r,a,o,l,s;return i=e,r=t.title,a=t.titleAttributes,o=n,l=T(a),s=C(r),l?"<"+i+' data-rh="true" '+l+">"+A(s,o)+"":"<"+i+' data-rh="true">'+A(s,o)+""}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return O(t)},toString:function(){return T(t)}};default:return{toComponent:function(){return M(e,t)},toString:function(){var i,r,a;return i=e,r=t,a=n,r.reduce(function(e,t){var n=Object.keys(t).filter(function(e){return!("innerHTML"===e||"cssText"===e)}).reduce(function(e,n){var i=void 0===t[n]?n:n+'="'+A(t[n],a)+'"';return e?e+" "+i:i},""),r=t.innerHTML||t.cssText||"",o=-1===z.indexOf(i);return e+"<"+i+' data-rh="true" '+n+(o?"/>":">"+r+"")},"")}}}},R=function(e){var t=e.baseTag,n=e.bodyAttributes,i=e.encode,r=e.htmlAttributes,a=e.noscriptTags,o=e.styleTags,l=e.title,s=e.titleAttributes,d=e.linkTags,c=e.metaTags,u=e.scriptTags,h={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var p,m,f,y,w,k,j,I=(m=(p=e).linkTags,f=p.scriptTags,y=p.encode,w=_(p.metaTags,b),k=_(m,x),j=_(f,v),{priorityMethods:{toComponent:function(){return[].concat(M(g.META,w.priority),M(g.LINK,k.priority),M(g.SCRIPT,j.priority))},toString:function(){return L(g.META,w.priority,y)+" "+L(g.LINK,k.priority,y)+" "+L(g.SCRIPT,j.priority,y)}},metaTags:w.default,linkTags:k.default,scriptTags:j.default});h=I.priorityMethods,d=I.linkTags,c=I.metaTags,u=I.scriptTags}return{priority:h,base:L(g.BASE,t,i),bodyAttributes:L("bodyAttributes",n,i),htmlAttributes:L("htmlAttributes",r,i),link:L(g.LINK,d,i),meta:L(g.META,c,i),noscript:L(g.NOSCRIPT,a,i),script:L(g.SCRIPT,u,i),style:L(g.STYLE,o,i),title:L(g.TITLE,{title:void 0===l?"":l,titleAttributes:s},i)}},$=[],B=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?$:n.instances},add:function(e){(n.canUseDOM?$:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?$:n.instances).indexOf(e);(n.canUseDOM?$:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=R({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},D=i.createContext({}),H=a().shape({setHelmet:a().func,helmetInstances:a().shape({get:a().func,add:a().func,remove:a().func})}),F="undefined"!=typeof document,W=function(e){function t(n){var i;return(i=e.call(this,n)||this).helmetData=new B(i.props.context,t.canUseDOM),i}return p(t,e),t.prototype.render=function(){return i.createElement(D.Provider,{value:this.helmetData.value},this.props.children)},t}(i.Component);W.canUseDOM=F,W.propTypes={context:a().shape({helmet:a().shape()}),children:a().node.isRequired},W.defaultProps={context:{}},W.displayName="HelmetProvider";var q=function(e,t){var n,i=document.head||document.querySelector(g.HEAD),r=i.querySelectorAll(e+"[data-rh]"),a=[].slice.call(r),o=[];return t&&t.length&&t.forEach(function(t){var i=document.createElement(e);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&("innerHTML"===r?i.innerHTML=t.innerHTML:"cssText"===r?i.styleSheet?i.styleSheet.cssText=t.cssText:i.appendChild(document.createTextNode(t.cssText)):i.setAttribute(r,void 0===t[r]?"":t[r]));i.setAttribute("data-rh","true"),a.some(function(e,t){return n=t,i.isEqualNode(e)})?a.splice(n,1):o.push(i)}),a.forEach(function(e){return e.parentNode.removeChild(e)}),o.forEach(function(e){return i.appendChild(e)}),{oldTags:a,newTags:o}},U=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var i=n.getAttribute("data-rh"),r=i?i.split(","):[],a=[].concat(r),o=Object.keys(t),l=0;l=0;u-=1)n.removeAttribute(a[u]);r.length===a.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==o.join(",")&&n.setAttribute("data-rh",o.join(","))}},V=function(e,t){var n,i,r=e.baseTag,a=e.htmlAttributes,o=e.linkTags,l=e.metaTags,s=e.noscriptTags,d=e.onChangeClientState,c=e.scriptTags,u=e.styleTags,h=e.title,p=e.titleAttributes;U(g.BODY,e.bodyAttributes),U(g.HTML,a),n=h,i=p,void 0!==n&&document.title!==n&&(document.title=C(n)),U(g.TITLE,i);var m={baseTag:q(g.BASE,r),linkTags:q(g.LINK,o),metaTags:q(g.META,l),noscriptTags:q(g.NOSCRIPT,s),scriptTags:q(g.SCRIPT,c),styleTags:q(g.STYLE,u)},f={},x={};Object.keys(m).forEach(function(e){var t=m[e],n=t.newTags,i=t.oldTags;n.length&&(f[e]=n),i.length&&(x[e]=m[e].oldTags)}),t&&t(),d(e,f,x)},G=null,Z=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,i=e.arrayTypeChildren;return h({},i,((t={})[n.type]=[].concat(i[n.type]||[],[h({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,i=e.child,r=e.newProps,a=e.newChildProps,o=e.nestedChildren;switch(i.type){case g.TITLE:return h({},r,((t={})[i.type]=o,t.titleAttributes=h({},a),t));case g.BODY:return h({},r,{bodyAttributes:h({},a)});case g.HTML:return h({},r,{htmlAttributes:h({},a)});default:return h({},r,((n={})[i.type]=h({},a),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=h({},t);return Object.keys(e).forEach(function(t){var i;n=h({},n,((i={})[t]=e[t],i))}),n},n.warnOnInvalidChildren=function(e,t){return d()(y.some(function(t){return e.type===t}),"function"==typeof e.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+y.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),d()(!t||"string"==typeof t||Array.isArray(t)&&!t.some(function(e){return"string"!=typeof e}),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``} ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,r={};return i.Children.forEach(e,function(e){if(e&&e.props){var i=e.props,a=i.children,o=f(i,Y),l=Object.keys(o).reduce(function(e,t){return e[k[t]||t]=o[t],e},{}),s=e.type;switch("symbol"==typeof s?s=s.toString():n.warnOnInvalidChildren(e,a),s){case g.FRAGMENT:t=n.mapChildrenToProps(a,t);break;case g.LINK:case g.META:case g.NOSCRIPT:case g.SCRIPT:case g.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:l,nestedChildren:a});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:l,nestedChildren:a})}}}),this.mapArrayTypeChildrenToProps(r,t)},n.render=function(){var e=this.props,t=e.children,n=f(e,K),r=h({},n),a=n.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!a||a instanceof B||(a=new B(a.context,a.instances)),a?i.createElement(Z,h({},r,{context:a.value,helmetData:void 0})):i.createElement(D.Consumer,null,function(e){return i.createElement(Z,h({},r,{context:e}))})},t}(i.Component);J.propTypes={base:a().object,bodyAttributes:a().object,children:a().oneOfType([a().arrayOf(a().node),a().node]),defaultTitle:a().string,defer:a().bool,encodeSpecialCharacters:a().bool,htmlAttributes:a().object,link:a().arrayOf(a().object),meta:a().arrayOf(a().object),noscript:a().arrayOf(a().object),onChangeClientState:a().func,script:a().arrayOf(a().object),style:a().arrayOf(a().object),title:a().string,titleAttributes:a().object,titleTemplate:a().string,prioritizeSeoTags:a().bool,helmetData:a().object},J.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},J.displayName="Helmet"},2897:function(e,t,n){"use strict";t.lazyWithPreload=void 0;var i,r=n(2363);function a(e){var t,n,i=(0,r.lazy)(e),a=(0,r.forwardRef)(function(e,n){var a=(0,r.useRef)(null!=t?t:i);return(0,r.createElement)(a.current,Object.assign(n?{ref:n}:{},e))});return a.preload=function(){return!n&&(n=e().then(function(e){return t=e.default})),n},a}t.lazyWithPreload=a},4251:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(538)).default;t.default=r},273:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(7520)).default;t.default=r},4580:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3610)).default;t.default=r},6586:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9551)).default;t.default=r},8960:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(7091)).default;t.default=r},1107:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9693)).default;t.default=r},9159:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9463)).default;t.default=r},6929:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3883)).default;t.default=r},8831:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(1337)).default;t.default=r},9549:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(9455)).default;t.default=r},6397:function(e,t,n){"use strict";var i=n(4361);t.default=void 0;var r=i(n(3847)).default;t.default=r},6778:function(e,t,n){"use strict";var i="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof n.g?n.g:{},r=function(){var e="Prism"in i,t=e?i.Prism:void 0;return function(){e?i.Prism=t:delete i.Prism,e=void 0,t=void 0}}();i.Prism={manual:!0,disableWorkerMessageHandler:!0};var a=n(4396),o=n(2668),l=n(3921),s=n(7264),d=n(7520),c=n(1860),u=n(9551);r();var h={}.hasOwnProperty;function p(){}p.prototype=l;var m=new p;function f(e){if("function"!=typeof e||!e.displayName)throw Error("Expected `function` for `grammar`, got `"+e+"`");void 0===m.languages[e.displayName]&&e(m)}e.exports=m,m.highlight=function(e,t){var n,i=l.highlight;if("string"!=typeof e)throw Error("Expected `string` for `value`, got `"+e+"`");if("Object"===m.util.type(t))n=t,t=null;else{if("string"!=typeof t)throw Error("Expected `string` for `name`, got `"+t+"`");if(h.call(m.languages,t))n=m.languages[t];else throw Error("Unknown language: `"+t+"` is not registered")}return i.call(this,e,n,t)},m.register=f,m.alias=function(e,t){var n,i,r,a,o=m.languages,l=e;for(n in t&&((l={})[e]=t),l)for(r=(i="string"==typeof(i=l[n])?[i]:i).length,a=-1;++a>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:i},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:i},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:i.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:i.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=i.variable[1].inside,o=0;o]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}e.exports=t,t.displayName="clike",t.aliases=[]},7520:function(e){"use strict";function t(e){var t,n,i;n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,(t=e).languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css,(i=t.languages.markup)&&(i.tag.addInlined("style","css"),i.tag.addAttribute("style","css"))}e.exports=t,t.displayName="css",t.aliases=[]},3610:function(e){"use strict";function t(e){var t,n;(t=e).languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]},Object.keys(n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"}).forEach(function(e){var i=n[e],r=[];!/^\w+$/.test(e)&&r.push(/\w+/.exec(e)[0]),"diff"===e&&r.push("bold"),t.languages.diff[e]={pattern:RegExp("^(?:["+i+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(e)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})}e.exports=t,t.displayName="diff",t.aliases=[]},9551:function(e){"use strict";function t(e){e.languages.javascript=e.languages.extend("clike",{"class-name":[e.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|")+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}e.exports=t,t.displayName="javascript",t.aliases=["js"]},7091:function(e){"use strict";function t(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}e.exports=t,t.displayName="json",t.aliases=["webmanifest"]},7942:function(e){"use strict";function t(e){!function(e){var t=e.util.clone(e.languages.javascript),n=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,i=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,r=/(?:\{*\.{3}(?:[^{}]|)*\})/.source;function a(e,t){return RegExp(e=e.replace(//g,function(){return n}).replace(//g,function(){return i}).replace(//g,function(){return r}),t)}r=a(r).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(o).join(""):""},l=function(t){for(var n=[],i=0;i0&&n[n.length-1].tagName===o(r.content[0].content[1])&&n.pop():"/>"===r.content[r.content.length-1].content||n.push({tagName:o(r.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===r.type&&"{"===r.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?n[n.length-1].openedBraces--:a=!0),(a||"string"==typeof r)&&n.length>0&&0===n[n.length-1].openedBraces){var s=o(r);i0&&("string"==typeof t[i-1]||"plain-text"===t[i-1].type)&&(s=o(t[i-1])+s,t.splice(i-1,1),i--),t[i]=new e.Token("plain-text",s,null,s)}r.content&&"string"!=typeof r.content&&l(r.content)}};e.hooks.add("after-tokenize",function(e){if("jsx"===e.language||"tsx"===e.language)l(e.tokens)})}(e)}e.exports=t,t.displayName="jsx",t.aliases=[]},9693:function(e){"use strict";function t(e){e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}e.exports=t,t.displayName="less",t.aliases=[]},9463:function(e){"use strict";function t(e){!function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var i=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return i}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+a+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+a+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(i),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(i),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])})}),e.hooks.add("after-tokenize",function(e){if("markdown"===e.language||"md"===e.language)!function e(t){if(!!t&&"string"!=typeof t)for(var n=0,i=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(e)}e.exports=t,t.displayName="markdown",t.aliases=["md"]},7264:function(e){"use strict";function t(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(t,n){var i={};i["language-"+n]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[n]},i.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:i}};r["language-"+n]={pattern:/[\s\S]+/,inside:e.languages[n]};var a={};a[t]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return t}),"i"),lookbehind:!0,greedy:!0,inside:r},e.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}e.exports=t,t.displayName="markup",t.aliases=["html","mathml","svg","xml","ssml","atom","rss"]},3883:function(e){"use strict";function t(e){var t,n,i;(t=e).languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule,n=/\$[-\w]+|#\{\$[-\w]+\}/,i=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}],t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:i}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:i,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}e.exports=t,t.displayName="sass",t.aliases=[]},1337:function(e){"use strict";function t(e){e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}e.exports=t,t.displayName="scss",t.aliases=[]},9455:function(e,t,n){"use strict";var i=n(7942),r=n(3847);function a(e){var t,n,a;e.register(i),e.register(r),n=(t=e).util.clone(t.languages.typescript),t.languages.tsx=t.languages.extend("jsx",n),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"],(a=t.languages.tsx.tag).pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0}e.exports=a,a.displayName="tsx",a.aliases=[]},3847:function(e){"use strict";function t(e){var t,n;(t=e).languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"],n=t.languages.extend("typescript",{}),delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript}e.exports=t,t.displayName="typescript",t.aliases=["ts"]},5241:function(e){e.exports=function(e,t,n,i){var r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;for(var l=Object.prototype.hasOwnProperty.bind(t),s=0;s1&&void 0!==arguments[1]?arguments[1]:{},i=window.Promise||function(e){function t(){}e(t,t)},r=function(){for(var e=arguments.length,t=Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=e.target,n=function(){var e={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},t=void 0,n=void 0;if(h.container){if(h.container instanceof Object)t=(e=p({},e,h.container)).width-e.left-e.right-2*h.margin,n=e.height-e.top-e.bottom-2*h.margin;else{var i=(f(h.container)?h.container:document.querySelector(h.container)).getBoundingClientRect();e=p({},e,{width:i.width,height:i.height,left:i.left,top:i.top})}}t=t||e.width-2*h.margin,n=n||e.height-2*h.margin;var r=m.zoomedHd||m.original,a=g(r)?t:r.naturalWidth||t,o=g(r)?n:r.naturalHeight||n,l=r.getBoundingClientRect(),s=l.top,d=l.left,c=l.width,u=l.height,x=Math.min(Math.min(Math.max(c,a),t)/c,Math.min(Math.max(u,o),n)/u),v=(-d+(t-c)/2+h.margin+e.left)/x,b=(-s+(n-u)/2+h.margin+e.top)/x,y="scale("+x+") translate3d("+v+"px, "+b+"px, 0)";m.zoomed.style.transform=y,m.zoomedHd&&(m.zoomedHd.style.transform=y)};return new i(function(e){if(t&&-1===s.indexOf(t)){e(k);return}if(m.zoomed){e(k);return}if(t)m.original=t;else if(s.length>0){var i=s;m.original=i[0]}else{e(k);return}if(m.original.dispatchEvent(y("medium-zoom:open",{detail:{zoom:k}})),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,c=!0,m.zoomed=b(m.original),document.body.appendChild(w),h.template){var r=f(h.template)?h.template:document.querySelector(h.template);m.template=document.createElement("div"),m.template.appendChild(r.content.cloneNode(!0)),document.body.appendChild(m.template)}if(m.original.parentElement&&"PICTURE"===m.original.parentElement.tagName&&m.original.currentSrc&&(m.zoomed.src=m.original.currentSrc),document.body.appendChild(m.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),m.original.classList.add("medium-zoom-image--hidden"),m.zoomed.classList.add("medium-zoom-image--opened"),m.zoomed.addEventListener("click",o),m.zoomed.addEventListener("transitionend",function t(){c=!1,m.zoomed.removeEventListener("transitionend",t),m.original.dispatchEvent(y("medium-zoom:opened",{detail:{zoom:k}})),e(k)}),m.original.getAttribute("data-zoom-src")){m.zoomedHd=m.zoomed.cloneNode(),m.zoomedHd.removeAttribute("srcset"),m.zoomedHd.removeAttribute("sizes"),m.zoomedHd.removeAttribute("loading"),m.zoomedHd.src=m.zoomed.getAttribute("data-zoom-src"),m.zoomedHd.onerror=function(){clearInterval(a),console.warn("Unable to reach the zoom image target "+m.zoomedHd.src),m.zoomedHd=null,n()};var a=setInterval(function(){m.zoomedHd.complete&&(clearInterval(a),m.zoomedHd.classList.add("medium-zoom-image--opened"),m.zoomedHd.addEventListener("click",o),document.body.appendChild(m.zoomedHd),n())},10)}else if(m.original.hasAttribute("srcset")){m.zoomedHd=m.zoomed.cloneNode(),m.zoomedHd.removeAttribute("sizes"),m.zoomedHd.removeAttribute("loading");var l=m.zoomedHd.addEventListener("load",function(){m.zoomedHd.removeEventListener("load",l),m.zoomedHd.classList.add("medium-zoom-image--opened"),m.zoomedHd.addEventListener("click",o),document.body.appendChild(m.zoomedHd),n()})}else n()})},o=function(){return new i(function(e){if(c||!m.original){e(k);return}c=!0,document.body.classList.remove("medium-zoom--opened"),m.zoomed.style.transform="",m.zoomedHd&&(m.zoomedHd.style.transform=""),m.template&&(m.template.style.transition="opacity 150ms",m.template.style.opacity=0),m.original.dispatchEvent(y("medium-zoom:close",{detail:{zoom:k}})),m.zoomed.addEventListener("transitionend",function t(){m.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(m.zoomed),m.zoomedHd&&document.body.removeChild(m.zoomedHd),document.body.removeChild(w),m.zoomed.classList.remove("medium-zoom-image--opened"),m.template&&document.body.removeChild(m.template),c=!1,m.zoomed.removeEventListener("transitionend",t),m.original.dispatchEvent(y("medium-zoom:closed",{detail:{zoom:k}})),m.original=null,m.zoomed=null,m.zoomedHd=null,m.template=null,e(k)})})},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.target;return m.original?o():a({target:t})},s=[],d=[],c=!1,u=0,h=n,m={original:null,zoomed:null,zoomedHd:null,template:null};"[object Object]"===Object.prototype.toString.call(t)?h=t:(t||"string"==typeof t)&&r(t);var w=v((h=p({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},h)).background);document.addEventListener("click",function(e){var t=e.target;if(t===w){o();return}if(-1!==s.indexOf(t))l({target:t})}),document.addEventListener("keyup",function(e){var t=e.key||e.keyCode;("Escape"===t||"Esc"===t||27===t)&&o()}),document.addEventListener("scroll",function(){if(!c&&!!m.original){var e=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(u-e)>h.scrollOffset&&setTimeout(o,150)}}),window.addEventListener("resize",o);var k={open:a,close:o,toggle:l,update:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e.background&&(w.style.background=e.background),e.container&&e.container instanceof Object&&(e.container=p({},h.container,e.container)),e.template){var t=f(e.template)?e.template:document.querySelector(e.template);e.template=t}return h=p({},h,e),s.forEach(function(e){e.dispatchEvent(y("medium-zoom:update",{detail:{zoom:k}}))}),k},clone:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e(p({},h,t))},attach:r,detach:function(){for(var e=arguments.length,t=Array(e),n=0;n0?t.reduce(function(e,t){return[].concat(e,x(t))},[]):s;return i.forEach(function(e){e.classList.remove("medium-zoom-image"),e.dispatchEvent(y("medium-zoom:detach",{detail:{zoom:k}}))}),s=s.filter(function(e){return -1===i.indexOf(e)}),k},on:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s.forEach(function(i){i.addEventListener("medium-zoom:"+e,t,n)}),d.push({type:"medium-zoom:"+e,listener:t,options:n}),k},off:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return s.forEach(function(i){i.removeEventListener("medium-zoom:"+e,t,n)}),d=d.filter(function(n){return!(n.type==="medium-zoom:"+e&&n.listener.toString()===t.toString())}),k},getOptions:function(){return h},getImages:function(){return s},getZoomedImage:function(){return m.original}};return k};n("5981");let k=[[function(e){let{pathname:t}=(0,u.TH)(),{selector:n=".rspress-doc img",options:i={}}=e;return(0,r.useEffect)(()=>{let e;let t=setTimeout(()=>{e=w(document.querySelectorAll(n),{...i,background:"var(--rp-c-bg)"})},100);return()=>{clearTimeout(t),null==e||e.detach(),null==e||e.close()}},[t]),null},{}]],j=n("1411");n("1763");async function I(e){var t,i;let{routes:r}=n(6118),s=(0,c.fp)(r,e);if(s){let t=s[0].route,n=await t.preload(),r=(0,a.bw)(s[0].route.filePath),d=o.Z.pages.find(t=>{let n=e=>e.replace(/\/$/,"").toLowerCase();return(0,l.pV)(n(t.routePath),n(e))}),c=encodeURIComponent(r),u=(null===(i=n.default.__RSPRESS_PAGE_META)||void 0===i?void 0:i[c])||{},{toc:h=[],title:p="",frontmatter:m={},...f}=a.kv.test(t.filePath)?u:n;return{siteData:o.Z,page:{...f,pagePath:r,...d,pageType:(null==m?void 0:m.pageType)||"doc",title:p,frontmatter:m,toc:h}}}let d=o.Z.lang||"",u=(null===(t=o.Z.multiVersion)||void 0===t?void 0:t.default)||"";if(o.Z.lang&&"undefined"!=typeof window){let e=location.pathname.replace(o.Z.base,"").split("/").slice(0,2);if(o.Z.locales.length){let t=o.Z.locales.find(t=>{let{lang:n}=t;return e.includes(n)});t&&(d=t.lang)}if(o.Z.multiVersion.versions){let t=o.Z.multiVersion.versions.find(t=>e.includes(t));t&&(u=t)}}return{siteData:o.Z,page:{pagePath:"",pageType:"404",routePath:"/404",lang:d,frontmatter:{},title:"404",toc:[],version:u,_filepath:"",_relativePath:""}}}function P(e){let{helmetContext:t}=e,{setData:n,data:a}=(0,r.useContext)(s.R0),o=a.page.frontmatter||{},{pathname:d,search:c}=(0,u.TH)(),p=new URLSearchParams(c),m="globalUIComponents",f=!1===o[m]||"0"===p.get(m);return(0,r.useLayoutEffect)(()=>{(async function e(){try{let e=await I((0,l.Tm)(d));n(e)}catch(e){console.log(e)}})()},[d,n]),(0,i.jsxs)(h.B6,{context:t,children:[(0,i.jsx)(j.ZP.Layout,{}),!f&&k.map((e,t)=>{if(Array.isArray(e)){let[n,i]=e;return r.createElement(n,{key:t,...i})}return r.createElement(e,{key:t})})]})}let S=o.Z.ssg,{default:E,useThemeState:C}=n(2285);(async function e(){let e=document.getElementById("root"),t=async()=>{let e=await I((0,l.Tm)(window.location.pathname));return function(){let[t,n]=(0,r.useState)(e),[a,o]=C();return(0,i.jsx)(s.Ni.Provider,{value:(0,r.useMemo)(()=>({theme:a,setTheme:o}),[a,o]),children:(0,i.jsx)(s.R0.Provider,{value:(0,r.useMemo)(()=>({data:t,setData:n}),[t,n]),children:(0,i.jsx)(d.VK,{children:(0,i.jsx)(P,{})})})})}},o=await t();{let{createRoot:t,hydrateRoot:r}=n(417);(0,a.yv)()&&S?r(e,(0,i.jsx)(o,{})):t(e).render((0,i.jsx)(o,{}))}})().then(()=>{E.setup()})},4031:function(e,t,n){"use strict";n.d(t,{YE:()=>i.YE,WG:()=>i.WG,ZB:()=>i.ZB,Rg:()=>i.Rg,KO:()=>i.KO,OK:()=>i.OK,Ar:()=>i.Ar,rU:()=>i.rU,JL:()=>i.JL,Qn:()=>i.Qn,RY:()=>i.RY,mi:()=>i.mi,BZ:()=>i.BZ,xN:()=>i.xN,Ct:()=>i.Ct,zx:()=>i.zx,xK:()=>i.xK,mQ:()=>i.mQ,Vp:()=>i.Vp,of:()=>i.of,UQ:()=>i.UQ,AV:()=>i.AV,tx:()=>i.tx,ls:()=>i.ls,ZP:()=>i.ZP,TJ:()=>i.TJ,zh:()=>i.zh,s2:()=>i.s2,H_:()=>i.H_,NG:()=>i.NG,VA:()=>i.VA,eF:()=>i.eF,cY:()=>i.cY,CU:()=>i.CU,CF:()=>i.CF,YS:()=>i.YS,Vl:()=>i.Vl,M4:()=>i.M4,eE:()=>i.eE,WS:()=>i.WS,xB:()=>i.xB,Os:()=>i.Os,O9:()=>i.O9,qx:()=>i.qx,g2:()=>i.g2,SU:()=>i.SU,Qe:()=>i.Qe,y2:()=>i.y2,pU:()=>i.pU,ol:()=>i.ol,EG:()=>i.EG});let i=n("1411")},6118:function(e,t,n){"use strict";n.r(t),n.d(t,{routes:function(){return eW}});var i=n(2363),r=n(2897);let a=(0,r.lazyWithPreload)(()=>n.e("5864").then(n.bind(n,8051))),o=(0,r.lazyWithPreload)(()=>n.e("6677").then(n.bind(n,9146))),l=(0,r.lazyWithPreload)(()=>n.e("5816").then(n.bind(n,6834))),s=(0,r.lazyWithPreload)(()=>n.e("4457").then(n.bind(n,8810))),d=(0,r.lazyWithPreload)(()=>n.e("864").then(n.bind(n,2585))),c=(0,r.lazyWithPreload)(()=>n.e("6832").then(n.bind(n,5142))),u=(0,r.lazyWithPreload)(()=>n.e("9033").then(n.bind(n,963))),h=(0,r.lazyWithPreload)(()=>n.e("1415").then(n.bind(n,6047))),p=(0,r.lazyWithPreload)(()=>n.e("7790").then(n.bind(n,4967))),m=(0,r.lazyWithPreload)(()=>n.e("266").then(n.bind(n,8325))),f=(0,r.lazyWithPreload)(()=>n.e("4038").then(n.bind(n,1891))),g=(0,r.lazyWithPreload)(()=>n.e("8169").then(n.bind(n,9730))),x=(0,r.lazyWithPreload)(()=>n.e("5116").then(n.bind(n,6261))),v=(0,r.lazyWithPreload)(()=>n.e("768").then(n.bind(n,3188))),b=(0,r.lazyWithPreload)(()=>n.e("3452").then(n.bind(n,891))),y=(0,r.lazyWithPreload)(()=>n.e("7936").then(n.bind(n,6795))),w=(0,r.lazyWithPreload)(()=>n.e("4781").then(n.bind(n,3492))),k=(0,r.lazyWithPreload)(()=>n.e("2828").then(n.bind(n,9489))),j=(0,r.lazyWithPreload)(()=>n.e("1178").then(n.bind(n,1573))),I=(0,r.lazyWithPreload)(()=>n.e("7316").then(n.bind(n,765))),P=(0,r.lazyWithPreload)(()=>n.e("2932").then(n.bind(n,9573))),S=(0,r.lazyWithPreload)(()=>n.e("207").then(n.bind(n,5462))),E=(0,r.lazyWithPreload)(()=>n.e("5353").then(n.bind(n,4364))),C=(0,r.lazyWithPreload)(()=>n.e("1655").then(n.bind(n,5716))),_=(0,r.lazyWithPreload)(()=>n.e("3390").then(n.bind(n,2032))),N=(0,r.lazyWithPreload)(()=>n.e("1857").then(n.bind(n,8391))),z=(0,r.lazyWithPreload)(()=>n.e("5570").then(n.bind(n,6022))),A=(0,r.lazyWithPreload)(()=>n.e("1042").then(n.bind(n,5523))),T=(0,r.lazyWithPreload)(()=>n.e("4831").then(n.bind(n,789))),O=(0,r.lazyWithPreload)(()=>n.e("5279").then(n.bind(n,9635))),M=(0,r.lazyWithPreload)(()=>n.e("9481").then(n.bind(n,2497))),L=(0,r.lazyWithPreload)(()=>n.e("6156").then(n.bind(n,4570))),R=(0,r.lazyWithPreload)(()=>n.e("4813").then(n.bind(n,5673))),$=(0,r.lazyWithPreload)(()=>n.e("4595").then(n.bind(n,8380))),B=(0,r.lazyWithPreload)(()=>n.e("6186").then(n.bind(n,7126))),D=(0,r.lazyWithPreload)(()=>n.e("9251").then(n.bind(n,4513))),H=(0,r.lazyWithPreload)(()=>n.e("8820").then(n.bind(n,547))),F=(0,r.lazyWithPreload)(()=>n.e("6663").then(n.bind(n,1040))),W=(0,r.lazyWithPreload)(()=>n.e("3495").then(n.bind(n,5209))),q=(0,r.lazyWithPreload)(()=>n.e("1645").then(n.bind(n,6696))),U=(0,r.lazyWithPreload)(()=>n.e("9905").then(n.bind(n,9834))),V=(0,r.lazyWithPreload)(()=>n.e("3515").then(n.bind(n,3711))),G=(0,r.lazyWithPreload)(()=>n.e("6486").then(n.bind(n,191))),Z=(0,r.lazyWithPreload)(()=>n.e("5302").then(n.bind(n,3174))),Y=(0,r.lazyWithPreload)(()=>n.e("7047").then(n.bind(n,2515))),K=(0,r.lazyWithPreload)(()=>n.e("3241").then(n.bind(n,2693))),J=(0,r.lazyWithPreload)(()=>n.e("4639").then(n.bind(n,4642))),Q=(0,r.lazyWithPreload)(()=>n.e("2539").then(n.bind(n,2260))),X=(0,r.lazyWithPreload)(()=>n.e("5661").then(n.bind(n,6177))),ee=(0,r.lazyWithPreload)(()=>n.e("3978").then(n.bind(n,7971))),et=(0,r.lazyWithPreload)(()=>n.e("109").then(n.bind(n,1767))),en=(0,r.lazyWithPreload)(()=>n.e("2598").then(n.bind(n,5622))),ei=(0,r.lazyWithPreload)(()=>n.e("7129").then(n.bind(n,296))),er=(0,r.lazyWithPreload)(()=>n.e("3669").then(n.bind(n,2913))),ea=(0,r.lazyWithPreload)(()=>n.e("150").then(n.bind(n,5679))),eo=(0,r.lazyWithPreload)(()=>n.e("8052").then(n.bind(n,8388))),el=(0,r.lazyWithPreload)(()=>n.e("1571").then(n.bind(n,4677))),es=(0,r.lazyWithPreload)(()=>n.e("3110").then(n.bind(n,9083))),ed=(0,r.lazyWithPreload)(()=>n.e("3771").then(n.bind(n,1880))),ec=(0,r.lazyWithPreload)(()=>n.e("4503").then(n.bind(n,5687))),eu=(0,r.lazyWithPreload)(()=>n.e("6231").then(n.bind(n,751))),eh=(0,r.lazyWithPreload)(()=>n.e("3069").then(n.bind(n,9759))),ep=(0,r.lazyWithPreload)(()=>n.e("6111").then(n.bind(n,6578))),em=(0,r.lazyWithPreload)(()=>n.e("3238").then(n.bind(n,4764))),ef=(0,r.lazyWithPreload)(()=>n.e("1").then(n.bind(n,4993))),eg=(0,r.lazyWithPreload)(()=>n.e("2122").then(n.bind(n,6421))),ex=(0,r.lazyWithPreload)(()=>n.e("1286").then(n.bind(n,2583))),ev=(0,r.lazyWithPreload)(()=>n.e("9892").then(n.bind(n,6753))),eb=(0,r.lazyWithPreload)(()=>n.e("3264").then(n.bind(n,3708))),ey=(0,r.lazyWithPreload)(()=>n.e("7207").then(n.bind(n,7489))),ew=(0,r.lazyWithPreload)(()=>n.e("3884").then(n.bind(n,5550))),ek=(0,r.lazyWithPreload)(()=>n.e("9710").then(n.bind(n,9079))),ej=(0,r.lazyWithPreload)(()=>n.e("7410").then(n.bind(n,9126))),eI=(0,r.lazyWithPreload)(()=>n.e("1086").then(n.bind(n,7985))),eP=(0,r.lazyWithPreload)(()=>n.e("9382").then(n.bind(n,2128))),eS=(0,r.lazyWithPreload)(()=>n.e("4800").then(n.bind(n,3781))),eE=(0,r.lazyWithPreload)(()=>n.e("8603").then(n.bind(n,2259))),eC=(0,r.lazyWithPreload)(()=>n.e("2138").then(n.bind(n,7963))),e_=(0,r.lazyWithPreload)(()=>n.e("9513").then(n.bind(n,599))),eN=(0,r.lazyWithPreload)(()=>n.e("2125").then(n.bind(n,8845))),ez=(0,r.lazyWithPreload)(()=>n.e("1920").then(n.bind(n,9097))),eA=(0,r.lazyWithPreload)(()=>n.e("598").then(n.bind(n,3423))),eT=(0,r.lazyWithPreload)(()=>n.e("2546").then(n.bind(n,6982))),eO=(0,r.lazyWithPreload)(()=>n.e("4534").then(n.bind(n,8035))),eM=(0,r.lazyWithPreload)(()=>n.e("1787").then(n.bind(n,5308))),eL=(0,r.lazyWithPreload)(()=>n.e("6147").then(n.bind(n,790))),eR=(0,r.lazyWithPreload)(()=>n.e("7402").then(n.bind(n,2530))),e$=(0,r.lazyWithPreload)(()=>n.e("455").then(n.bind(n,5453))),eB=(0,r.lazyWithPreload)(()=>n.e("8477").then(n.bind(n,4243))),eD=(0,r.lazyWithPreload)(()=>n.e("8648").then(n.bind(n,8949))),eH=(0,r.lazyWithPreload)(()=>n.e("7244").then(n.bind(n,3442))),eF=(0,r.lazyWithPreload)(()=>n.e("9725").then(n.bind(n,6584))),eW=[{path:"/module-tools/en/api/config/build-config",element:i.createElement(a),filePath:"en/api/config/build-config.mdx",preload:async()=>(await a.preload(),n.e("5864").then(n.bind(n,8051))),lang:"en",version:""},{path:"/module-tools/en/api/config/build-preset",element:i.createElement(o),filePath:"en/api/config/build-preset.mdx",preload:async()=>(await o.preload(),n.e("6677").then(n.bind(n,9146))),lang:"en",version:""},{path:"/module-tools/en/api/config/dev",element:i.createElement(l),filePath:"en/api/config/dev.md",preload:async()=>(await l.preload(),n.e("5816").then(n.bind(n,6834))),lang:"en",version:""},{path:"/module-tools/en/api/config/plugins",element:i.createElement(s),filePath:"en/api/config/plugins.md",preload:async()=>(await s.preload(),n.e("4457").then(n.bind(n,8810))),lang:"en",version:""},{path:"/module-tools/en/api/",element:i.createElement(d),filePath:"en/api/index.md",preload:async()=>(await d.preload(),n.e("864").then(n.bind(n,2585))),lang:"en",version:""},{path:"/module-tools/en/api/plugin-api/plugin-hooks",element:i.createElement(c),filePath:"en/api/plugin-api/plugin-hooks.md",preload:async()=>(await c.preload(),n.e("6832").then(n.bind(n,5142))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-exception",element:i.createElement(u),filePath:"en/components/faq-build-exception.mdx",preload:async()=>(await u.preload(),n.e("9033").then(n.bind(n,963))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-other",element:i.createElement(h),filePath:"en/components/faq-build-other.mdx",preload:async()=>(await h.preload(),n.e("1415").then(n.bind(n,6047))),lang:"en",version:""},{path:"/module-tools/en/components/faq-build-product",element:i.createElement(p),filePath:"en/components/faq-build-product.mdx",preload:async()=>(await p.preload(),n.e("7790").then(n.bind(n,4967))),lang:"en",version:""},{path:"/module-tools/en/components/faq-storybook",element:i.createElement(m),filePath:"en/components/faq-storybook.mdx",preload:async()=>(await m.preload(),n.e("266").then(n.bind(n,8325))),lang:"en",version:""},{path:"/module-tools/en/components/publish-emo",element:i.createElement(f),filePath:"en/components/publish-emo.mdx",preload:async()=>(await f.preload(),n.e("4038").then(n.bind(n,1891))),lang:"en",version:""},{path:"/module-tools/en/components/register-esbuild-plugin",element:i.createElement(g),filePath:"en/components/register-esbuild-plugin.mdx",preload:async()=>(await g.preload(),n.e("8169").then(n.bind(n,9730))),lang:"en",version:""},{path:"/module-tools/en/components/release-module-doc",element:i.createElement(x),filePath:"en/components/release-module-doc.mdx",preload:async()=>(await x.preload(),n.e("5116").then(n.bind(n,6261))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/asset",element:i.createElement(v),filePath:"en/guide/advance/asset.mdx",preload:async()=>(await v.preload(),n.e("768").then(n.bind(n,3188))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/build-umd",element:i.createElement(b),filePath:"en/guide/advance/build-umd.mdx",preload:async()=>(await b.preload(),n.e("3452").then(n.bind(n,891))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/copy",element:i.createElement(y),filePath:"en/guide/advance/copy.md",preload:async()=>(await y.preload(),n.e("7936").then(n.bind(n,6795))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/external-dependency",element:i.createElement(w),filePath:"en/guide/advance/external-dependency.mdx",preload:async()=>(await w.preload(),n.e("4781").then(n.bind(n,3492))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-build",element:i.createElement(k),filePath:"en/guide/advance/in-depth-about-build.md",preload:async()=>(await k.preload(),n.e("2828").then(n.bind(n,9489))),lang:"en",version:""},{path:"/module-tools/en/guide/advance/in-depth-about-dev-command",element:i.createElement(j),filePath:"en/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await j.preload(),n.e("1178").then(n.bind(n,1573))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/before-getting-started",element:i.createElement(I),filePath:"en/guide/basic/before-getting-started.md",preload:async()=>(await I.preload(),n.e("7316").then(n.bind(n,765))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/command-preview",element:i.createElement(P),filePath:"en/guide/basic/command-preview.md",preload:async()=>(await P.preload(),n.e("2932").then(n.bind(n,9573))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/modify-output-product",element:i.createElement(S),filePath:"en/guide/basic/modify-output-product.md",preload:async()=>(await S.preload(),n.e("207").then(n.bind(n,5462))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/publish-your-project",element:i.createElement(E),filePath:"en/guide/basic/publish-your-project.mdx",preload:async()=>(await E.preload(),n.e("5353").then(n.bind(n,4364))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-micro-generator",element:i.createElement(C),filePath:"en/guide/basic/use-micro-generator.md",preload:async()=>(await C.preload(),n.e("1655").then(n.bind(n,5716))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/use-module-doc",element:i.createElement(_),filePath:"en/guide/basic/use-module-doc.mdx",preload:async()=>(await _.preload(),n.e("3390").then(n.bind(n,2032))),lang:"en",version:""},{path:"/module-tools/en/guide/basic/using-storybook",element:i.createElement(N),filePath:"en/guide/basic/using-storybook.mdx",preload:async()=>(await N.preload(),n.e("1857").then(n.bind(n,8391))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/components",element:i.createElement(z),filePath:"en/guide/best-practices/components.mdx",preload:async()=>(await z.preload(),n.e("5570").then(n.bind(n,6022))),lang:"en",version:""},{path:"/module-tools/en/guide/best-practices/use-tailwindcss",element:i.createElement(A),filePath:"en/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await A.preload(),n.e("1042").then(n.bind(n,5523))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/basic",element:i.createElement(T),filePath:"en/guide/faq/basic.mdx",preload:async()=>(await T.preload(),n.e("4831").then(n.bind(n,789))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/build",element:i.createElement(O),filePath:"en/guide/faq/build.mdx",preload:async()=>(await O.preload(),n.e("5279").then(n.bind(n,9635))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/",element:i.createElement(M),filePath:"en/guide/faq/index.md",preload:async()=>(await M.preload(),n.e("9481").then(n.bind(n,2497))),lang:"en",version:""},{path:"/module-tools/en/guide/faq/storybook",element:i.createElement(L),filePath:"en/guide/faq/storybook.mdx",preload:async()=>(await L.preload(),n.e("6156").then(n.bind(n,4570))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/getting-started",element:i.createElement(R),filePath:"en/guide/intro/getting-started.mdx",preload:async()=>(await R.preload(),n.e("4813").then(n.bind(n,5673))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/welcome",element:i.createElement($),filePath:"en/guide/intro/welcome.md",preload:async()=>(await $.preload(),n.e("4595").then(n.bind(n,8380))),lang:"en",version:""},{path:"/module-tools/en/guide/intro/why-module-engineering-solution",element:i.createElement(B),filePath:"en/guide/intro/why-module-engineering-solution.md",preload:async()=>(await B.preload(),n.e("6186").then(n.bind(n,7126))),lang:"en",version:""},{path:"/module-tools/en/",element:i.createElement(D),filePath:"en/index.md",preload:async()=>(await D.preload(),n.e("9251").then(n.bind(n,4513))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/getting-started",element:i.createElement(H),filePath:"en/plugins/guide/getting-started.mdx",preload:async()=>(await H.preload(),n.e("8820").then(n.bind(n,547))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/plugin-object",element:i.createElement(F),filePath:"en/plugins/guide/plugin-object.mdx",preload:async()=>(await F.preload(),n.e("6663").then(n.bind(n,1040))),lang:"en",version:""},{path:"/module-tools/en/plugins/guide/setup-function",element:i.createElement(W),filePath:"en/plugins/guide/setup-function.mdx",preload:async()=>(await W.preload(),n.e("3495").then(n.bind(n,5209))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/overview",element:i.createElement(q),filePath:"en/plugins/official-list/overview.md",preload:async()=>(await q.preload(),n.e("1645").then(n.bind(n,6696))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-babel",element:i.createElement(U),filePath:"en/plugins/official-list/plugin-babel.mdx",preload:async()=>(await U.preload(),n.e("9905").then(n.bind(n,9834))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-banner",element:i.createElement(V),filePath:"en/plugins/official-list/plugin-banner.mdx",preload:async()=>(await V.preload(),n.e("3515").then(n.bind(n,3711))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-import",element:i.createElement(G),filePath:"en/plugins/official-list/plugin-import.mdx",preload:async()=>(await G.preload(),n.e("6486").then(n.bind(n,191))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-node-polyfill",element:i.createElement(Z),filePath:"en/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await Z.preload(),n.e("5302").then(n.bind(n,3174))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-polyfill",element:i.createElement(Y),filePath:"en/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await Y.preload(),n.e("7047").then(n.bind(n,2515))),lang:"en",version:""},{path:"/module-tools/en/plugins/official-list/plugin-vue",element:i.createElement(K),filePath:"en/plugins/official-list/plugin-vue.mdx",preload:async()=>(await K.preload(),n.e("3241").then(n.bind(n,2693))),lang:"en",version:""},{path:"/module-tools/api/config/build-config",element:i.createElement(J),filePath:"zh/api/config/build-config.mdx",preload:async()=>(await J.preload(),n.e("4639").then(n.bind(n,4642))),lang:"zh",version:""},{path:"/module-tools/api/config/build-preset",element:i.createElement(Q),filePath:"zh/api/config/build-preset.mdx",preload:async()=>(await Q.preload(),n.e("2539").then(n.bind(n,2260))),lang:"zh",version:""},{path:"/module-tools/api/config/dev",element:i.createElement(X),filePath:"zh/api/config/dev.md",preload:async()=>(await X.preload(),n.e("5661").then(n.bind(n,6177))),lang:"zh",version:""},{path:"/module-tools/api/config/plugins",element:i.createElement(ee),filePath:"zh/api/config/plugins.md",preload:async()=>(await ee.preload(),n.e("3978").then(n.bind(n,7971))),lang:"zh",version:""},{path:"/module-tools/api/",element:i.createElement(et),filePath:"zh/api/index.md",preload:async()=>(await et.preload(),n.e("109").then(n.bind(n,1767))),lang:"zh",version:""},{path:"/module-tools/api/plugin-api/plugin-hooks",element:i.createElement(en),filePath:"zh/api/plugin-api/plugin-hooks.md",preload:async()=>(await en.preload(),n.e("2598").then(n.bind(n,5622))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-exception",element:i.createElement(ei),filePath:"zh/components/faq-build-exception.mdx",preload:async()=>(await ei.preload(),n.e("7129").then(n.bind(n,296))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-other",element:i.createElement(er),filePath:"zh/components/faq-build-other.mdx",preload:async()=>(await er.preload(),n.e("3669").then(n.bind(n,2913))),lang:"zh",version:""},{path:"/module-tools/components/faq-build-product",element:i.createElement(ea),filePath:"zh/components/faq-build-product.mdx",preload:async()=>(await ea.preload(),n.e("150").then(n.bind(n,5679))),lang:"zh",version:""},{path:"/module-tools/components/faq-storybook",element:i.createElement(eo),filePath:"zh/components/faq-storybook.mdx",preload:async()=>(await eo.preload(),n.e("8052").then(n.bind(n,8388))),lang:"zh",version:""},{path:"/module-tools/components/publish-emo",element:i.createElement(el),filePath:"zh/components/publish-emo.mdx",preload:async()=>(await el.preload(),n.e("1571").then(n.bind(n,4677))),lang:"zh",version:""},{path:"/module-tools/components/register-esbuild-plugin",element:i.createElement(es),filePath:"zh/components/register-esbuild-plugin.mdx",preload:async()=>(await es.preload(),n.e("3110").then(n.bind(n,9083))),lang:"zh",version:""},{path:"/module-tools/components/release-module-doc",element:i.createElement(ed),filePath:"zh/components/release-module-doc.mdx",preload:async()=>(await ed.preload(),n.e("3771").then(n.bind(n,1880))),lang:"zh",version:""},{path:"/module-tools/guide/advance/asset",element:i.createElement(ec),filePath:"zh/guide/advance/asset.mdx",preload:async()=>(await ec.preload(),n.e("4503").then(n.bind(n,5687))),lang:"zh",version:""},{path:"/module-tools/guide/advance/build-umd",element:i.createElement(eu),filePath:"zh/guide/advance/build-umd.mdx",preload:async()=>(await eu.preload(),n.e("6231").then(n.bind(n,751))),lang:"zh",version:""},{path:"/module-tools/guide/advance/copy",element:i.createElement(eh),filePath:"zh/guide/advance/copy.md",preload:async()=>(await eh.preload(),n.e("3069").then(n.bind(n,9759))),lang:"zh",version:""},{path:"/module-tools/guide/advance/external-dependency",element:i.createElement(ep),filePath:"zh/guide/advance/external-dependency.mdx",preload:async()=>(await ep.preload(),n.e("6111").then(n.bind(n,6578))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-build",element:i.createElement(em),filePath:"zh/guide/advance/in-depth-about-build.md",preload:async()=>(await em.preload(),n.e("3238").then(n.bind(n,4764))),lang:"zh",version:""},{path:"/module-tools/guide/advance/in-depth-about-dev-command",element:i.createElement(ef),filePath:"zh/guide/advance/in-depth-about-dev-command.md",preload:async()=>(await ef.preload(),n.e("1").then(n.bind(n,4993))),lang:"zh",version:""},{path:"/module-tools/guide/basic/before-getting-started",element:i.createElement(eg),filePath:"zh/guide/basic/before-getting-started.md",preload:async()=>(await eg.preload(),n.e("2122").then(n.bind(n,6421))),lang:"zh",version:""},{path:"/module-tools/guide/basic/command-preview",element:i.createElement(ex),filePath:"zh/guide/basic/command-preview.md",preload:async()=>(await ex.preload(),n.e("1286").then(n.bind(n,2583))),lang:"zh",version:""},{path:"/module-tools/guide/basic/modify-output-product",element:i.createElement(ev),filePath:"zh/guide/basic/modify-output-product.md",preload:async()=>(await ev.preload(),n.e("9892").then(n.bind(n,6753))),lang:"zh",version:""},{path:"/module-tools/guide/basic/publish-your-project",element:i.createElement(eb),filePath:"zh/guide/basic/publish-your-project.mdx",preload:async()=>(await eb.preload(),n.e("3264").then(n.bind(n,3708))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-micro-generator",element:i.createElement(ey),filePath:"zh/guide/basic/use-micro-generator.md",preload:async()=>(await ey.preload(),n.e("7207").then(n.bind(n,7489))),lang:"zh",version:""},{path:"/module-tools/guide/basic/use-module-doc",element:i.createElement(ew),filePath:"zh/guide/basic/use-module-doc.mdx",preload:async()=>(await ew.preload(),n.e("3884").then(n.bind(n,5550))),lang:"zh",version:""},{path:"/module-tools/guide/basic/using-storybook",element:i.createElement(ek),filePath:"zh/guide/basic/using-storybook.mdx",preload:async()=>(await ek.preload(),n.e("9710").then(n.bind(n,9079))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/components",element:i.createElement(ej),filePath:"zh/guide/best-practices/components.mdx",preload:async()=>(await ej.preload(),n.e("7410").then(n.bind(n,9126))),lang:"zh",version:""},{path:"/module-tools/guide/best-practices/use-tailwindcss",element:i.createElement(eI),filePath:"zh/guide/best-practices/use-tailwindcss.mdx",preload:async()=>(await eI.preload(),n.e("1086").then(n.bind(n,7985))),lang:"zh",version:""},{path:"/module-tools/guide/faq/basic",element:i.createElement(eP),filePath:"zh/guide/faq/basic.mdx",preload:async()=>(await eP.preload(),n.e("9382").then(n.bind(n,2128))),lang:"zh",version:""},{path:"/module-tools/guide/faq/build",element:i.createElement(eS),filePath:"zh/guide/faq/build.mdx",preload:async()=>(await eS.preload(),n.e("4800").then(n.bind(n,3781))),lang:"zh",version:""},{path:"/module-tools/guide/faq/",element:i.createElement(eE),filePath:"zh/guide/faq/index.md",preload:async()=>(await eE.preload(),n.e("8603").then(n.bind(n,2259))),lang:"zh",version:""},{path:"/module-tools/guide/faq/storybook",element:i.createElement(eC),filePath:"zh/guide/faq/storybook.mdx",preload:async()=>(await eC.preload(),n.e("2138").then(n.bind(n,7963))),lang:"zh",version:""},{path:"/module-tools/guide/intro/getting-started",element:i.createElement(e_),filePath:"zh/guide/intro/getting-started.mdx",preload:async()=>(await e_.preload(),n.e("9513").then(n.bind(n,599))),lang:"zh",version:""},{path:"/module-tools/guide/intro/welcome",element:i.createElement(eN),filePath:"zh/guide/intro/welcome.md",preload:async()=>(await eN.preload(),n.e("2125").then(n.bind(n,8845))),lang:"zh",version:""},{path:"/module-tools/guide/intro/why-module-engineering-solution",element:i.createElement(ez),filePath:"zh/guide/intro/why-module-engineering-solution.md",preload:async()=>(await ez.preload(),n.e("1920").then(n.bind(n,9097))),lang:"zh",version:""},{path:"/module-tools/",element:i.createElement(eA),filePath:"zh/index.md",preload:async()=>(await eA.preload(),n.e("598").then(n.bind(n,3423))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/getting-started",element:i.createElement(eT),filePath:"zh/plugins/guide/getting-started.mdx",preload:async()=>(await eT.preload(),n.e("2546").then(n.bind(n,6982))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/plugin-object",element:i.createElement(eO),filePath:"zh/plugins/guide/plugin-object.mdx",preload:async()=>(await eO.preload(),n.e("4534").then(n.bind(n,8035))),lang:"zh",version:""},{path:"/module-tools/plugins/guide/setup-function",element:i.createElement(eM),filePath:"zh/plugins/guide/setup-function.mdx",preload:async()=>(await eM.preload(),n.e("1787").then(n.bind(n,5308))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/overview",element:i.createElement(eL),filePath:"zh/plugins/official-list/overview.md",preload:async()=>(await eL.preload(),n.e("6147").then(n.bind(n,790))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-babel",element:i.createElement(eR),filePath:"zh/plugins/official-list/plugin-babel.mdx",preload:async()=>(await eR.preload(),n.e("7402").then(n.bind(n,2530))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-banner",element:i.createElement(e$),filePath:"zh/plugins/official-list/plugin-banner.mdx",preload:async()=>(await e$.preload(),n.e("455").then(n.bind(n,5453))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-import",element:i.createElement(eB),filePath:"zh/plugins/official-list/plugin-import.mdx",preload:async()=>(await eB.preload(),n.e("8477").then(n.bind(n,4243))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-node-polyfill",element:i.createElement(eD),filePath:"zh/plugins/official-list/plugin-node-polyfill.mdx",preload:async()=>(await eD.preload(),n.e("8648").then(n.bind(n,8949))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-polyfill",element:i.createElement(eH),filePath:"zh/plugins/official-list/plugin-polyfill.mdx",preload:async()=>(await eH.preload(),n.e("7244").then(n.bind(n,3442))),lang:"zh",version:""},{path:"/module-tools/plugins/official-list/plugin-vue",element:i.createElement(eF),filePath:"zh/plugins/official-list/plugin-vue.mdx",preload:async()=>(await eF.preload(),n.e("9725").then(n.bind(n,6584))),lang:"zh",version:""}]},6780:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});let i={title:"Modern.js Module",description:"",icon:"https://lf3-static.bytednsdoc.com/obj/eden-cn/zq-uylkvT/ljhwZthlaukjlkulzlp/logo-1x-0104.png",themeConfig:{footer:{message:"Copyright \xa9 2023 ByteDance."},socialLinks:[{icon:"github",mode:"link",content:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools"}],locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],editLink:{docRepoBaseUrl:"https://github.com/web-infra-dev/modern.js/tree/main/packages/document/module-doc/docs",text:"Edit this page on GitHub"}},base:"/module-tools/",lang:"zh",locales:[{lang:"zh",label:"\u7B80\u4F53\u4E2D\u6587",nav:[{text:"\u6307\u5357",link:"/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/api/",activeMatch:"^/api/"},{text:"\u63D2\u4EF6",link:"/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"\u66F4\u65B0\u65E5\u5FD7",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"\u8D21\u732E\u6307\u5357",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",outlineTitle:"\u76EE\u5F55",prevPageText:"\u4E0A\u4E00\u9875",nextPageText:"\u4E0B\u4E00\u9875",description:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",sidebar:{"/api/":[{text:"\u6982\u89C8",link:"/module-tools/api/"},{text:"\u914D\u7F6E\u9879",link:"",items:[{text:"buildConfig",link:"/module-tools/api/config/build-config"},{text:"buildPreset",link:"/module-tools/api/config/build-preset"},{text:"dev",link:"/module-tools/api/config/dev"},{text:"plugins",link:"/module-tools/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/guide/":[{text:"\u4ECB\u7ECD",link:"",items:[{text:"\u6B22\u8FCE\u4F7F\u7528",link:"/module-tools/guide/intro/welcome"},{text:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",link:"/module-tools/guide/intro/why-module-engineering-solution"},{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"\u57FA\u7840\u4F7F\u7528",link:"",items:[{text:"\u5F00\u59CB\u4E4B\u524D",link:"/module-tools/guide/basic/before-getting-started"},{text:"CLI \u547D\u4EE4",link:"/module-tools/guide/basic/command-preview"},{text:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",link:"/module-tools/guide/basic/modify-output-product"},{text:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",link:"/module-tools/guide/basic/use-micro-generator"},{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",link:"/module-tools/guide/basic/use-module-doc"},{text:"\u4F7F\u7528 Storybook",link:"/module-tools/guide/basic/using-storybook"},{text:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",link:"/module-tools/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"\u8FDB\u9636\u6307\u5357",link:"",items:[{text:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",link:"/module-tools/guide/advance/in-depth-about-build"},{text:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",link:"/module-tools/guide/advance/in-depth-about-dev-command"},{text:"\u4F7F\u7528 Copy \u5DE5\u5177",link:"/module-tools/guide/advance/copy"},{text:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",link:"/module-tools/guide/advance/external-dependency"},{text:"\u6784\u5EFA umd \u4EA7\u7269",link:"/module-tools/guide/advance/build-umd"},{text:"\u5904\u7406\u9759\u6001\u8D44\u6E90",link:"/module-tools/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"\u6700\u4F73\u5B9E\u8DF5",link:"",items:[{text:"\u5F00\u53D1\u7EC4\u4EF6",link:"/module-tools/guide/best-practices/components"},{text:"\u4F7F\u7528 Tailwind CSS",link:"/module-tools/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"\u5E38\u89C1\u95EE\u9898",link:"/module-tools/guide/faq/",items:[{text:"\u901A\u7528\u7C7B\u95EE\u9898",link:"/module-tools/guide/faq/basic"},{text:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/build"},{text:"Storybook \u76F8\u5173\u95EE\u9898",link:"/module-tools/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/plugins/":[{text:"\u6307\u5357",link:"",items:[{text:"\u5FEB\u901F\u5F00\u59CB",link:"/module-tools/plugins/guide/getting-started"},{text:"\u63D2\u4EF6\u5BF9\u8C61",link:"/module-tools/plugins/guide/plugin-object"},{text:"Setup \u51FD\u6570",link:"/module-tools/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"\u63D2\u4EF6\u5217\u8868",link:"",items:[{text:"\u603B\u89C8",link:"/module-tools/plugins/official-list/overview"},{text:"Babel \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-babel"},{text:"Banner \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-banner"},{text:"Import \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-import"},{text:"Node Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-polyfill"},{text:"Vue \u63D2\u4EF6",link:"/module-tools/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}},{lang:"en",label:"English",nav:[{text:"Guide",link:"/en/guide/intro/welcome",activeMatch:"^/guide/"},{text:"API",link:"/en/api/",activeMatch:"^/api/"},{text:"Plugins",link:"/en/plugins/guide/getting-started",activeMatch:"^/plugins/"},{text:"v2.57.0",items:[{text:"Changelog",link:"https://github.com/web-infra-dev/modern.js/tree/main/packages/solutions/module-tools/CHANGELOG.md"},{text:"Contributing",link:"https://modernjs.dev/en/community/contributing-guide.html"}]}],title:"Modern.js Module",description:"Module Engineering Solutions",sidebar:{"/en/api/":[{text:"Overview",link:"/module-tools/en/api/"},{text:"Config",link:"",items:[{text:"buildConfig",link:"/module-tools/en/api/config/build-config"},{text:"buildPreset",link:"/module-tools/en/api/config/build-preset"},{text:"dev",link:"/module-tools/en/api/config/dev"},{text:"plugins",link:"/module-tools/en/api/config/plugins"}],collapsed:!1,collapsible:!0},{text:"Plugin API",link:"",items:[{text:"Plugin Hooks",link:"/module-tools/en/api/plugin-api/plugin-hooks"}],collapsed:!1,collapsible:!0}],"/en/guide/":[{text:"Introduction",link:"",items:[{text:"Welcome to Modern.js Module",link:"/module-tools/en/guide/intro/welcome"},{text:"Why you need Modern.js Module",link:"/module-tools/en/guide/intro/why-module-engineering-solution"},{text:"Quick Start",link:"/module-tools/en/guide/intro/getting-started"}],collapsed:!1,collapsible:!0},{text:"Basic Guide",link:"",items:[{text:"Before you start",link:"/module-tools/en/guide/basic/before-getting-started"},{text:"CLI Commands",link:"/module-tools/en/guide/basic/command-preview"},{text:"Modify the output",link:"/module-tools/en/guide/basic/modify-output-product"},{text:"Using the Microgenerator",link:"/module-tools/en/guide/basic/use-micro-generator"},{text:"Developing Module documentation",link:"/module-tools/en/guide/basic/use-module-doc"},{text:"Using Storybook",link:"/module-tools/en/guide/basic/using-storybook"},{text:"Versioning and Publishing",link:"/module-tools/en/guide/basic/publish-your-project"}],collapsed:!1,collapsible:!0},{text:"Advanced Guide",link:"",items:[{text:"In-depth understanding of build",link:"/module-tools/en/guide/advance/in-depth-about-build"},{text:"In-depth understanding of the dev command",link:"/module-tools/en/guide/advance/in-depth-about-dev-command"},{text:"Use the Copy Tools",link:"/module-tools/en/guide/advance/copy"},{text:"Handle third-party dependencies",link:"/module-tools/en/guide/advance/external-dependency"},{text:"Build umd artifacts",link:"/module-tools/en/guide/advance/build-umd"},{text:"Handle static assets",link:"/module-tools/en/guide/advance/asset"}],collapsed:!1,collapsible:!0},{text:"Best practices",link:"",items:[{text:"Developing Components",link:"/module-tools/en/guide/best-practices/components"},{text:"Using Tailwind CSS",link:"/module-tools/en/guide/best-practices/use-tailwindcss"}],collapsed:!1,collapsible:!0},{text:"FAQ",link:"/module-tools/en/guide/faq/",items:[{text:"General Questions",link:"/module-tools/en/guide/faq/basic"},{text:"Build FAQ",link:"/module-tools/en/guide/faq/build"},{text:"Storybook FAQ",link:"/module-tools/en/guide/faq/storybook"}],collapsed:!1,collapsible:!0}],"/en/plugins/":[{text:"Guide",link:"",items:[{text:"Quick Start",link:"/module-tools/en/plugins/guide/getting-started"},{text:"Plugin Object",link:"/module-tools/en/plugins/guide/plugin-object"},{text:"Setup function",link:"/module-tools/en/plugins/guide/setup-function"}],collapsed:!1,collapsible:!0},{text:"Plugins List",link:"",items:[{text:"Overview",link:"/module-tools/en/plugins/official-list/overview"},{text:"Babel Plugin",link:"/module-tools/en/plugins/official-list/plugin-babel"},{text:"Banner Plugin",link:"/module-tools/en/plugins/official-list/plugin-banner"},{text:"Import Plugin",link:"/module-tools/en/plugins/official-list/plugin-import"},{text:"Node Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-node-polyfill"},{text:"Polyfill Plugin",link:"/module-tools/en/plugins/official-list/plugin-polyfill"},{text:"Vue Plugin",link:"/module-tools/en/plugins/official-list/plugin-vue"}],collapsed:!1,collapsible:!0}]}}],logo:"",logoText:"",ssg:!0,multiVersion:{default:"",versions:[]},search:{},pages:[{title:"buildConfig",routePath:"/module-tools/en/api/config/build-config",lang:"en",toc:[{text:"alias",id:"alias",depth:2,charIndex:378},{text:"asset",id:"asset",depth:2,charIndex:1054},{text:"asset.name",id:"assetname",depth:2,charIndex:1113},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:1571},{text:"asset.path",id:"assetpath",depth:2,charIndex:2045},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:2149},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:2336},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:2783},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:2901},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:3018},{text:"autoExtension",id:"autoextension",depth:2,charIndex:3299},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:4498},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:5006},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:5142},{text:"banner",id:"banner",depth:2,charIndex:5273},{text:"buildType",id:"buildtype",depth:2,charIndex:5514},{text:"copy",id:"copy",depth:2,charIndex:5674},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:5850},{text:"copy.options",id:"copyoptions",depth:2,charIndex:5908},{text:"define",id:"define",depth:2,charIndex:6133},{text:"dts",id:"dts",depth:2,charIndex:7312},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:7435},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:7919},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:8081},{text:"dts.only",id:"dtsonly",depth:2,charIndex:8508},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:8664},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:8793},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:9225},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:10401},{text:"externals",id:"externals",depth:2,charIndex:10923},{text:"footer",id:"footer",depth:2,charIndex:11113},{text:"format",id:"format",depth:2,charIndex:11209},{text:"format: esm",id:"format-esm",depth:3,charIndex:11396},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:11536},{text:"format: iife",id:"format-iife",depth:3,charIndex:11732},{text:"format: umd",id:"format-umd",depth:3,charIndex:12026},{text:"hooks",id:"hooks",depth:2,charIndex:12329},{text:"input",id:"input",depth:2,charIndex:12816},{text:"jsx",id:"jsx",depth:2,charIndex:13845},{text:"metafile",id:"metafile",depth:2,charIndex:14376},{text:"minify",id:"minify",depth:2,charIndex:14805},{text:"outDir",id:"outdir",depth:2,charIndex:14948},{text:"platform",id:"platform",depth:2,charIndex:15042},{text:"redirect",id:"redirect",depth:2,charIndex:15273},{text:"resolve",id:"resolve",depth:2,charIndex:15789},{text:"resolve.alias",id:"resolvealias",depth:3,charIndex:15834},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:16667},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:17160},{text:"shims",id:"shims",depth:2,charIndex:17625},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:18046},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:18895},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:19153},{text:"sourceType",id:"sourcetype",depth:2,charIndex:19264},{text:"splitting",id:"splitting",depth:2,charIndex:19491},{text:"style",id:"style",depth:2,charIndex:19654},{text:"style.less",id:"styleless",depth:2,charIndex:19702},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:19744},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:19869},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:19990},{text:"style.sass",id:"stylesass",depth:2,charIndex:20335},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:20378},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:20484},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:20616},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:20956},{text:"style.inject",id:"styleinject",depth:2,charIndex:21304},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:22317},{text:"style.modules",id:"stylemodules",depth:2,charIndex:22664},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:22964},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3,charIndex:23078},{text:"Type",id:"type",depth:3,charIndex:23287},{text:"Notes",id:"notes",depth:3,charIndex:23592},{text:"target",id:"target",depth:2,charIndex:24175},{text:"transformImport",id:"transformimport",depth:2,charIndex:24539},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:24895},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:25396},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:25501},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:25812}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/en/api/config/build-preset",lang:"en",toc:[{text:"`npm-library`",id:"npm-library",depth:3,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:3,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:3,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:3,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:3,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:1651}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/en/api/config/dev",lang:"en",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:93},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:239},{text:"Configure Manager App",id:"configure-manager-app",depth:4,charIndex:506},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:686}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/en/api/config/plugins",lang:"en",toc:[{text:"Plugin Execution Order",id:"plugin-execution-order",depth:2,charIndex:140},{text:"Developing Plugins",id:"developing-plugins",depth:2,charIndex:584},{text:"Example",id:"example",depth:2,charIndex:680},{text:"Using Plugins from npm",id:"using-plugins-from-npm",depth:3,charIndex:691},{text:"Using Local Plugins",id:"using-local-plugins",depth:4,charIndex:837},{text:"Plugin Configuration",id:"plugin-configuration",depth:3,charIndex:960}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/api/config/plugins.md"},{title:"Overview",routePath:"/module-tools/en/api/",lang:"en",toc:[],frontmatter:{overview:!0,sidebar_label:"Overview",sidebar_position:1},version:"",_relativePath:"en/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/en/api/plugin-api/plugin-hooks",lang:"en",toc:[{text:"Config hooks",id:"config-hooks",depth:2,charIndex:509},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"build hooks",id:"build-hooks",depth:2,charIndex:596},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform hooks",id:"buildplatform-hooks",depth:2,charIndex:1494},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"Dev Hooks",id:"dev-hooks",depth:2,charIndex:2796},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"en/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/en/components/faq-build-exception",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-other",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/en/components/faq-build-product",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/en/components/faq-storybook",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/en/components/publish-emo",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/en/components/register-esbuild-plugin",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/en/components/release-module-doc",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/components/release-module-doc.mdx"},{title:"Handle static assets",routePath:"/module-tools/en/guide/advance/asset",lang:"en",toc:[{text:"Default behavior",id:"default-behavior",depth:2,charIndex:139},{text:"Example",id:"example",depth:2,charIndex:571}],frontmatter:{sidebar_position:6},version:"",_relativePath:"en/guide/advance/asset.mdx"},{title:"Build umd artifacts",routePath:"/module-tools/en/guide/advance/build-umd",lang:"en",toc:[{text:"Third-party dependency handling for umd artifacts",id:"third-party-dependency-handling-for-umd-artifacts",depth:2,charIndex:412},{text:"Example",id:"example",depth:3,charIndex:716},{text:"Global variable names of third-party dependencies",id:"global-variable-names-of-third-party-dependencies",depth:3,charIndex:1171},{text:"Changing the name of a global variable in a project",id:"changing-the-name-of-a-global-variable-in-a-project",depth:2,charIndex:1831}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/advance/build-umd.mdx"},{title:"Use the Copy Tools",routePath:"/module-tools/en/guide/advance/copy",lang:"en",toc:[{text:"Understanding the Copy API",id:"understanding-the-copy-api",depth:2,charIndex:171},{text:"API Description",id:"api-description",depth:2,charIndex:335},{text:"Examples of Different Scenarios",id:"examples-of-different-scenarios",depth:2,charIndex:1783},{text:"Copying Files",id:"copying-files",depth:3,charIndex:1818},{text:"Copying Files to a Directory",id:"copying-files-to-a-directory",depth:3,charIndex:1837},{text:"Copying from Directory to Directory",id:"copying-from-directory-to-directory",depth:3,charIndex:1871},{text:"Copying from Directory to File",id:"copying-from-directory-to-file",depth:3,charIndex:1912},{text:"Using Glob",id:"using-glob",depth:3,charIndex:1948}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/advance/copy.md"},{title:"Handle third-party dependencies",routePath:"/module-tools/en/guide/advance/external-dependency",lang:"en",toc:[{text:"Default handling of third-party dependencies",id:"default-handling-of-third-party-dependencies",depth:2,charIndex:811},{text:"Example",id:"example",depth:3,charIndex:1373},{text:"Exclude specified third-party dependencies",id:"exclude-specified-third-party-dependencies",depth:2,charIndex:1643}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/advance/external-dependency.mdx"},{title:"In-depth understanding of build",routePath:"/module-tools/en/guide/advance/in-depth-about-build",lang:"en",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"use swc",id:"use-swc",depth:2,charIndex:2845},{text:"Using Hooks to Intervene in the Build Process",id:"using-hooks-to-intervene-in-the-build-process",depth:2,charIndex:3803},{text:"Hook type",id:"hook-type",depth:3,charIndex:4183},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:4195},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:4334},{text:"Hook API",id:"hook-api",depth:3,charIndex:4431},{text:"load",id:"load",depth:4,charIndex:4442},{text:"transform",id:"transform",depth:4,charIndex:4626},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:4837},{text:"dts",id:"dts",depth:2,charIndex:5071},{text:"Turn off type generation",id:"turn-off-type-generation",depth:3,charIndex:5154},{text:"Build type files",id:"build-type-files",depth:3,charIndex:5357},{text:"Alias Conversion",id:"alias-conversion",depth:3,charIndex:6424},{text:"Some examples of the use of `dts`",id:"some-examples-of-the-use-of-dts",depth:3,charIndex:-1},{text:"Build process",id:"build-process",depth:2,charIndex:6764},{text:"Build errors",id:"build-errors",depth:2,charIndex:7057},{text:"Debug mode",id:"debug-mode",depth:2,charIndex:7582}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/advance/in-depth-about-build.md"},{title:"In-depth understanding of the dev command",routePath:"/module-tools/en/guide/advance/in-depth-about-dev-command",lang:"en",toc:[{text:"The overall flow of the command run",id:"the-overall-flow-of-the-command-run",depth:2,charIndex:92},{text:"Extending the dev command",id:"extending-the-dev-command",depth:2,charIndex:806}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/advance/in-depth-about-dev-command.md"},{title:"Before you start",routePath:"/module-tools/en/guide/basic/before-getting-started",lang:"en",toc:[{text:"Environment preparation",id:"environment-preparation",depth:2,charIndex:3},{text:"Getting Started with npm",id:"getting-started-with-npm",depth:2,charIndex:424},{text:"npm package type project",id:"npm-package-type-project",depth:2,charIndex:906},{text:"Using third-party npm packages",id:"using-third-party-npm-packages",depth:2,charIndex:1922},{text:"Other npm bits and pieces to know",id:"other-npm-bits-and-pieces-to-know",depth:2,charIndex:3606},{text:"Program entry for npm packages",id:"program-entry-for-npm-packages",depth:3,charIndex:3643},{text:"`scripts`",id:"scripts",depth:3,charIndex:-1},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:5883},{text:"npm package manager",id:"npm-package-manager",depth:2,charIndex:6585},{text:"Modern.js Module configuration file",id:"modernjs-module-configuration-file",depth:2,charIndex:6850}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/basic/before-getting-started.md"},{title:"CLI Commands",routePath:"/module-tools/en/guide/basic/command-preview",lang:"en",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/basic/command-preview.md"},{title:"Modify the output",routePath:"/module-tools/en/guide/basic/modify-output-product",lang:"en",toc:[{text:"Default output artifacts",id:"default-output-artifacts",depth:2,charIndex:3},{text:"buildPreset",id:"buildpreset",depth:2,charIndex:818},{text:"buildConfig",id:"buildconfig",depth:2,charIndex:1639},{text:"Combining Configuration and Presets",id:"combining-configuration-and-presets",depth:2,charIndex:4390}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/basic/modify-output-product.md"},{title:"Versioning and Publishing",routePath:"/module-tools/en/guide/basic/publish-your-project",lang:"en",toc:[{text:"Tracking changes",id:"tracking-changes",depth:2,charIndex:610},{text:"Version update",id:"version-update",depth:2,charIndex:1355},{text:"Publish",id:"publish",depth:2,charIndex:1780},{text:"Pre-releases",id:"pre-releases",depth:2,charIndex:2468}],frontmatter:{sidebar_position:7},version:"",_relativePath:"en/guide/basic/publish-your-project.mdx"},{title:"Using the Microgenerator",routePath:"/module-tools/en/guide/basic/use-micro-generator",lang:"en",toc:[{text:"Develop Module Doc",id:"develop-module-doc",depth:2,charIndex:431},{text:"Storybook",id:"storybook",depth:2,charIndex:895},{text:"Tailwind CSS Support",id:"tailwind-css-support",depth:2,charIndex:1243},{text:"Modern.js Runtime API",id:"modernjs-runtime-api",depth:2,charIndex:1528}],frontmatter:{sidebar_position:4},version:"",_relativePath:"en/guide/basic/use-micro-generator.md"},{title:"Developing Module documentation",routePath:"/module-tools/en/guide/basic/use-module-doc",lang:"en",toc:[{text:"Before we start",id:"before-we-start",depth:2,charIndex:98},{text:"Why we need to build a documentation site for a module",id:"why-we-need-to-build-a-documentation-site-for-a-module",depth:3,charIndex:117},{text:"Preliminary preparation",id:"preliminary-preparation",depth:3,charIndex:451},{text:"Basic site structure",id:"basic-site-structure",depth:2,charIndex:686},{text:"Configure sidebar",id:"configure-sidebar",depth:3,charIndex:1493},{text:"Writing Documentation",id:"writing-documentation",depth:2,charIndex:2109},{text:"Component preview",id:"component-preview",depth:2,charIndex:2329},{text:"Example",id:"example",depth:3,charIndex:2514},{text:"Mobile Preview",id:"mobile-preview",depth:3,charIndex:3121},{text:"Using external demos",id:"using-external-demos",depth:3,charIndex:3451},{text:"Using built-in components",id:"using-built-in-components",depth:2,charIndex:3691},{text:"API",id:"api",depth:3,charIndex:3837},{text:"Parse file",id:"parse-file",depth:4,charIndex:3883},{text:"Content generation",id:"content-generation",depth:4,charIndex:3981},{text:"Using the component",id:"using-the-component",depth:4,charIndex:5005},{text:"Overview",id:"overview",depth:3,charIndex:5154},{text:"Plugin options",id:"plugin-options",depth:2,charIndex:5675},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:5693},{text:"doc",id:"doc",depth:3,charIndex:5817},{text:"entries",id:"entries",depth:3,charIndex:5833},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:6040},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:6320},{text:"previewMode",id:"previewmode",depth:3,charIndex:6408},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:6599},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:6746},{text:"Scripts",id:"scripts",depth:2,charIndex:6967},{text:"Advanced guide",id:"advanced-guide",depth:2,charIndex:7130}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/use-module-doc.mdx"},{title:"Using Storybook",routePath:"/module-tools/en/guide/basic/using-storybook",lang:"en",toc:[{text:"V7 (Recommended)",id:"v7-recommended",depth:2,charIndex:511},{text:"Enable Storybook",id:"enable-storybook",depth:3,charIndex:531},{text:"Enable Debug output",id:"enable-debug-output",depth:3,charIndex:985},{text:"Enable Rspack build",id:"enable-rspack-build",depth:3,charIndex:2036},{text:"Configurations",id:"configurations",depth:3,charIndex:2361},{text:"bundler",id:"bundler",depth:4,charIndex:2441},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:2579},{text:"Command",id:"command",depth:3,charIndex:2782},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:2850},{text:"storybook build",id:"storybook-build",depth:4,charIndex:2890},{text:"Migrate from V6 to V7",id:"migrate-from-v6-to-v7",depth:2,charIndex:2948},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:3767},{text:"Start Storybook",id:"start-storybook",depth:3,charIndex:4013},{text:"Configure Storybook",id:"configure-storybook",depth:3,charIndex:4352},{text:"Build Storybook Output",id:"build-storybook-output",depth:3,charIndex:5092}],frontmatter:{sidebar_position:5},version:"",_relativePath:"en/guide/basic/using-storybook.mdx"},{title:"Developing Components",routePath:"/module-tools/en/guide/best-practices/components",lang:"en",toc:[{text:"Initialize the project",id:"initialize-the-project",depth:2,charIndex:93},{text:"Debugging code with Storybook",id:"debugging-code-with-storybook",depth:2,charIndex:406},{text:"Developing Styles",id:"developing-styles",depth:2,charIndex:505},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:711},{text:"Less",id:"less",depth:3,charIndex:1098},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:1251},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:1414},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:1488},{text:"Configuring build artifacts",id:"configuring-build-artifacts",depth:2,charIndex:1852},{text:"Releasing components",id:"releasing-components",depth:2,charIndex:2666}],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/best-practices/components.mdx"},{title:"Using Tailwind CSS",routePath:"/module-tools/en/guide/best-practices/use-tailwindcss",lang:"en",toc:[{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:2,charIndex:252},{text:"Configuring Tailwind CSS",id:"configuring-tailwind-css",depth:2,charIndex:1105},{text:"Tailwind CSS Autocomplete",id:"tailwind-css-autocomplete",depth:3,charIndex:1889},{text:"Build Modes",id:"build-modes",depth:2,charIndex:2460},{text:"Bundle Mode",id:"bundle-mode",depth:3,charIndex:2728},{text:"Bundleless Mode",id:"bundleless-mode",depth:3,charIndex:3091},{text:"Class Name Prefix",id:"class-name-prefix",depth:2,charIndex:3254},{text:"Usage Guide",id:"usage-guide",depth:2,charIndex:3641},{text:"HTML Class Names",id:"html-class-names",depth:3,charIndex:3703},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:4211},{text:"Less",id:"less",depth:4,charIndex:4413},{text:"About `designSystem` config",id:"about-designsystem-config",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/best-practices/use-tailwindcss.mdx"},{title:"General Questions",routePath:"/module-tools/en/guide/faq/basic",lang:"en",toc:[{text:"What is the relationship between Modern.js Module and Rsbuild?",id:"what-is-the-relationship-between-modernjs-module-and-rsbuild",depth:2,charIndex:3},{text:"Can Modern.js Module use webpack plugins or loaders?",id:"can-modernjs-module-use-webpack-plugins-or-loaders",depth:2,charIndex:210}],frontmatter:{},version:"",_relativePath:"en/guide/faq/basic.mdx"},{title:"Build FAQ",routePath:"/module-tools/en/guide/faq/build",lang:"en",toc:[{text:"Product FAQ",id:"product-faq",depth:2,charIndex:301},{text:"Initialization of Class Fields",id:"initialization-of-class-fields",depth:3,charIndex:316},{text:"babel-plugin-lodash treats the introduced lodash as `undefined`",id:"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:2578},{text:"Exceptions FAQ",id:"exceptions-faq",depth:2,charIndex:2995},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:3013},{text:"Problem Description",id:"problem-description",depth:4,charIndex:3059},{text:"Solution",id:"solution",depth:4,charIndex:3287},{text:"Reference Links",id:"reference-links",depth:4,charIndex:3792},{text:"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`",id:"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:4560},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:5206},{text:'Error reported for `defineConfig` function type: `If there is no reference to "..." then the inferred type of "default" cannot be named`',id:"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named",depth:3,charIndex:-1},{text:"Other FAQ",id:"other-faq",depth:2,charIndex:5958},{text:"How to skip the pre-processing of less/scss files with bundleless",id:"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless",depth:3,charIndex:5971},{text:"Add additional compilation feature",id:"add-additional-compilation-feature",depth:3,charIndex:6445},{text:"Support for generating TypeScript declaration files for CSS Modules",id:"support-for-generating-typescript-declaration-files-for-css-modules",depth:3,charIndex:7173}],frontmatter:{},version:"",_relativePath:"en/guide/faq/build.mdx"},{title:"FAQ",routePath:"/module-tools/en/guide/faq/",lang:"en",toc:[],frontmatter:{},version:"",_relativePath:"en/guide/faq/index.md"},{title:"Storybook FAQ",routePath:"/module-tools/en/guide/faq/storybook",lang:"en",toc:[{text:"Storybook v7 Support",id:"storybook-v7-support",depth:2,charIndex:3},{text:"Using Storybook Addon or other configurations does not work",id:"using-storybook-addon-or-other-configurations-does-not-work",depth:2,charIndex:104},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:519},{text:"Unable to locate the specific error message",id:"unable-to-locate-the-specific-error-message",depth:2,charIndex:681},{text:"Can`t find any stories is your Storybook",id:"cant-find-any-stories-is-your-storybook",depth:2,charIndex:900},{text:"Storybook Adds Proxy Functionality",id:"storybook-adds-proxy-functionality",depth:2,charIndex:1200},{text:"Tailwind CSS doesn't work in Storybook",id:"tailwind-css-doesnt-work-in-storybook",depth:2,charIndex:1585}],frontmatter:{},version:"",_relativePath:"en/guide/faq/storybook.mdx"},{title:"Quick Start",routePath:"/module-tools/en/guide/intro/getting-started",lang:"en",toc:[{text:"3 minute demo",id:"3-minute-demo",depth:2,charIndex:3},{text:"Create new project",id:"create-new-project",depth:3,charIndex:209},{text:"Add to an existing project",id:"add-to-an-existing-project",depth:3,charIndex:855},{text:"Core npm Package",id:"core-npm-package",depth:3,charIndex:1577},{text:"View official example",id:"view-official-example",depth:3,charIndex:2272},{text:"Let's get started",id:"lets-get-started",depth:2,charIndex:2407}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/guide/intro/getting-started.mdx"},{title:"Welcome to Modern.js Module",routePath:"/module-tools/en/guide/intro/welcome",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/guide/intro/welcome.md"},{title:"Why you need Modern.js Module",routePath:"/module-tools/en/guide/intro/why-module-engineering-solution",lang:"en",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/en/",lang:"en",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"Module engineering solutions",tagline:"simple, powerful, high-performance modern npm package development solution",actions:[{theme:"brand",text:"Welcome",link:"/guide/intro/welcome"},{theme:"alt",text:"Quick Start",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: The High Performance JS Bundler",details:"Built on esbuild, the build is extremely fast and gives you the ultimate development experience.",icon:"\uD83D\uDE80"},{title:"Two build modes",details:"Both bundle and bundleless build modes are supported.",icon:"\u2728"},{title:"Out of the box",details:"Develop your npm packages without too much configuration, with built-in presets covering a wide range of scenarios.",icon:"\uD83D\uDEE0\uFE0F"},{title:"Extensible: Provides a powerful plugin mechanism",details:"With its plugin extension mechanism, you can easily extend the capabilities of Modern.js Module.",icon:"\uD83C\uDFA8"},{title:"Storybook: The community popular UI development tool",details:"Integrated with Storybook, you can use it to debug UI.",icon:"\uD83D\uDCE6"},{title:"Lint: Code Formatting",details:"Built-in ESLint rules for rich scenarios.",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"en/index.md"},{title:"Quick Start",routePath:"/module-tools/en/plugins/guide/getting-started",lang:"en",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"en/plugins/guide/getting-started.mdx"},{title:"Plugin Object",routePath:"/module-tools/en/plugins/guide/plugin-object",lang:"en",toc:[{text:"Plugin type definitions",id:"plugin-type-definitions",depth:2,charIndex:570},{text:"Plugin configuration options",id:"plugin-configuration-options",depth:2,charIndex:741}],frontmatter:{sidebar_position:2},version:"",_relativePath:"en/plugins/guide/plugin-object.mdx"},{title:"Setup function",routePath:"/module-tools/en/plugins/guide/setup-function",lang:"en",toc:[{text:"Plugin API objects",id:"plugin-api-objects",depth:2,charIndex:173},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"Asynchronous setup",id:"asynchronous-setup",depth:2,charIndex:993},{text:"Life cycle hooks",id:"life-cycle-hooks",depth:2,charIndex:1434}],frontmatter:{sidebar_position:3},version:"",_relativePath:"en/plugins/guide/setup-function.mdx"},{title:"Overview",routePath:"/module-tools/en/plugins/official-list/overview",lang:"en",toc:[{text:"Official Plugins",id:"official-plugins",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/overview.md"},{title:"Babel Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-babel",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:110},{text:"Install",id:"install",depth:3,charIndex:125},{text:"Register",id:"register",depth:3,charIndex:136},{text:"Config",id:"config",depth:2,charIndex:372}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-babel.mdx"},{title:"Banner Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-banner",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:89},{text:"Install",id:"install",depth:3,charIndex:104},{text:"Register",id:"register",depth:3,charIndex:115},{text:"Example",id:"example",depth:2,charIndex:271},{text:"Add copyright information at the top of a JS file",id:"add-copyright-information-at-the-top-of-a-js-file",depth:3,charIndex:282},{text:"Configuration",id:"configuration",depth:2,charIndex:337},{text:"banner",id:"banner",depth:3,charIndex:365},{text:"footer",id:"footer",depth:3,charIndex:505}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-banner.mdx"},{title:"Import Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-import",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:230},{text:"Install",id:"install",depth:3,charIndex:245},{text:"Register",id:"register",depth:3,charIndex:256},{text:"Configurations",id:"configurations",depth:2,charIndex:413},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:443},{text:"Notes",id:"notes",depth:2,charIndex:602}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-node-polyfill",lang:"en",toc:[{text:"Quick Start",id:"quick-start",depth:2,charIndex:460},{text:"Install",id:"install",depth:3,charIndex:475},{text:"Register",id:"register",depth:3,charIndex:486},{text:"Configurations",id:"configurations",depth:2,charIndex:569},{text:"exclude",id:"exclude",depth:3,charIndex:599},{text:"overrides",id:"overrides",depth:3,charIndex:655},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:708},{text:"Globals",id:"globals",depth:3,charIndex:726},{text:"Modules",id:"modules",depth:3,charIndex:877},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:1336}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-polyfill",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:497},{text:"Install",id:"install",depth:3,charIndex:512},{text:"Register",id:"register",depth:3,charIndex:523},{text:"Config",id:"config",depth:2,charIndex:778},{text:"targets",id:"targets",depth:3,charIndex:799}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue Plugin",routePath:"/module-tools/en/plugins/official-list/plugin-vue",lang:"en",toc:[{text:"Quick start",id:"quick-start",depth:2,charIndex:547},{text:"Install",id:"install",depth:3,charIndex:562},{text:"Register",id:"register",depth:3,charIndex:573},{text:"Options",id:"options",depth:2,charIndex:656},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:667}],frontmatter:{},version:"",_relativePath:"en/plugins/official-list/plugin-vue.mdx"},{title:"buildConfig",routePath:"/module-tools/api/config/build-config",lang:"zh",toc:[{text:"alias",id:"alias",depth:2,charIndex:141},{text:"asset",id:"asset",depth:2,charIndex:483},{text:"asset.name",id:"assetname",depth:2,charIndex:506},{text:"asset.limit",id:"assetlimit",depth:2,charIndex:753},{text:"asset.path",id:"assetpath",depth:2,charIndex:981},{text:"asset.publicPath",id:"assetpublicpath",depth:2,charIndex:1052},{text:"asset.svgr",id:"assetsvgr",depth:2,charIndex:1159},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2,charIndex:1411},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2,charIndex:1510},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2,charIndex:1611},{text:"autoExtension",id:"autoextension",depth:2,charIndex:1802},{text:"autoExternal",id:"autoexternal",depth:2,charIndex:2393},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2,charIndex:2670},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2,charIndex:2758},{text:"banner",id:"banner",depth:2,charIndex:2854},{text:"buildType",id:"buildtype",depth:2,charIndex:2984},{text:"copy",id:"copy",depth:2,charIndex:3087},{text:"copy.patterns",id:"copypatterns",depth:2,charIndex:3128},{text:"copy.options",id:"copyoptions",depth:2,charIndex:3180},{text:"define",id:"define",depth:2,charIndex:3341},{text:"dts",id:"dts",depth:2,charIndex:3802},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2,charIndex:3864},{text:"dts.distPath",id:"dtsdistpath",depth:2,charIndex:4097},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2,charIndex:4196},{text:"dts.only",id:"dtsonly",depth:2,charIndex:4419},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2,charIndex:4499},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2,charIndex:4718},{text:"esbuildOptions",id:"esbuildoptions",depth:2,charIndex:4790},{text:"externalHelpers",id:"externalhelpers",depth:2,charIndex:5293},{text:"externals",id:"externals",depth:2,charIndex:5501},{text:"footer",id:"footer",depth:2,charIndex:5617},{text:"format",id:"format",depth:2,charIndex:5655},{text:"format: esm",id:"format-esm",depth:3,charIndex:5780},{text:"format: cjs",id:"format-cjs",depth:3,charIndex:5859},{text:"format: iife",id:"format-iife",depth:3,charIndex:5957},{text:"format: umd",id:"format-umd",depth:3,charIndex:6058},{text:"hooks",id:"hooks",depth:2,charIndex:6211},{text:"input",id:"input",depth:2,charIndex:6359},{text:"jsx",id:"jsx",depth:2,charIndex:6824},{text:"metafile",id:"metafile",depth:2,charIndex:7147},{text:"minify",id:"minify",depth:2,charIndex:7385},{text:"outDir",id:"outdir",depth:2,charIndex:7505},{text:"platform",id:"platform",depth:2,charIndex:7559},{text:"redirect",id:"redirect",depth:2,charIndex:7693},{text:"resolve",id:"resolve",depth:2,charIndex:7924},{text:"resolve.alias",id:"resolvealias",depth:3,charIndex:7946},{text:"resolve.mainFields",id:"resolvemainfields",depth:3,charIndex:8396},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3,charIndex:8713},{text:"shims",id:"shims",depth:2,charIndex:8970},{text:"sideEffects",id:"sideeffects",depth:2,charIndex:9237},{text:"sourceDir",id:"sourcedir",depth:2,charIndex:9679},{text:"sourceMap",id:"sourcemap",depth:2,charIndex:9795},{text:"sourceType",id:"sourcetype",depth:2,charIndex:9882},{text:"splitting",id:"splitting",depth:2,charIndex:10040},{text:"style",id:"style",depth:2,charIndex:10153},{text:"style.less",id:"styleless",depth:2,charIndex:10174},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2,charIndex:10200},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2,charIndex:10291},{text:"style.less.implementation",id:"stylelessimplementation",depth:2,charIndex:10375},{text:"sass",id:"sass",depth:2,charIndex:10550},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2,charIndex:10570},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2,charIndex:10640},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2,charIndex:10735},{text:"style.postcss",id:"stylepostcss",depth:2,charIndex:10911},{text:"style.inject",id:"styleinject",depth:2,charIndex:11070},{text:"style.autoModules",id:"styleautomodules",depth:2,charIndex:11566},{text:"style.modules",id:"stylemodules",depth:2,charIndex:11800},{text:"style.tailwindcss",id:"styletailwindcss",depth:2,charIndex:11979},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3,charIndex:12061},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3,charIndex:12181},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3,charIndex:12312},{text:"target",id:"target",depth:2,charIndex:12602},{text:"transformImport",id:"transformimport",depth:2,charIndex:12768},{text:"transformLodash",id:"transformlodash",depth:2,charIndex:12964},{text:"tsconfig",id:"tsconfig",depth:2,charIndex:13206},{text:"umdGlobals",id:"umdglobals",depth:2,charIndex:13294},{text:"umdModuleName",id:"umdmodulename",depth:2,charIndex:13454}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/api/config/build-config.mdx"},{title:"buildPreset",routePath:"/module-tools/api/config/build-preset",lang:"zh",toc:[{text:"`npm-library`",id:"npm-library",depth:2,charIndex:-1},{text:"`npm-library-with-umd`",id:"npm-library-with-umd",depth:2,charIndex:-1},{text:"`npm-component`",id:"npm-component",depth:2,charIndex:-1},{text:"`npm-component-with-umd`",id:"npm-component-with-umd",depth:2,charIndex:-1},{text:"`npm-library-{es5...esnext}`",id:"npm-library-es5esnext",depth:2,charIndex:-1},{text:"string / function",id:"string--function",depth:2,charIndex:835}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/api/config/build-preset.mdx"},{title:"dev",routePath:"/module-tools/api/config/dev",lang:"zh",toc:[{text:"storybook",id:"storybook",depth:2,charIndex:43},{text:"storybook.webpack",id:"storybookwebpack",depth:3,charIndex:118},{text:"\u914D\u7F6E Manager App",id:"\u914D\u7F6E-manager-app",depth:4,charIndex:314},{text:"storybook.webpackChain",id:"storybookwebpackchain",depth:3,charIndex:417}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/api/config/dev.md"},{title:"plugins",routePath:"/module-tools/api/config/plugins",lang:"zh",toc:[{text:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",id:"\u63D2\u4EF6\u6267\u884C\u987A\u5E8F",depth:2,charIndex:79},{text:"\u5F00\u53D1\u63D2\u4EF6",id:"\u5F00\u53D1\u63D2\u4EF6",depth:2,charIndex:221},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:253},{text:"\u4F7F\u7528 npm \u4E0A\u7684\u63D2\u4EF6",id:"\u4F7F\u7528-npm-\u4E0A\u7684\u63D2\u4EF6",depth:3,charIndex:259},{text:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",id:"\u4F7F\u7528\u672C\u5730\u63D2\u4EF6",depth:4,charIndex:316},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:3,charIndex:364}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/api/config/plugins.md"},{title:"\u6982\u89C8",routePath:"/module-tools/api/",lang:"zh",toc:[],frontmatter:{overview:!0,sidebar_label:"\u6982\u89C8",sidebar_position:1},version:"",_relativePath:"zh/api/index.md"},{title:"Plugin Hooks",routePath:"/module-tools/api/plugin-api/plugin-hooks",lang:"zh",toc:[{text:"\u914D\u7F6E\u94A9\u5B50",id:"\u914D\u7F6E\u94A9\u5B50",depth:2,charIndex:209},{text:"`resolveModuleUserConfig`",id:"resolvemoduleuserconfig",depth:3,charIndex:-1},{text:"\u6784\u5EFA\u94A9\u5B50",id:"\u6784\u5EFA\u94A9\u5B50",depth:2,charIndex:276},{text:"`beforeBuild`",id:"beforebuild",depth:3,charIndex:-1},{text:"`beforeBuildTask`",id:"beforebuildtask",depth:3,charIndex:-1},{text:"`afterBuildTask`",id:"afterbuildtask",depth:3,charIndex:-1},{text:"`afterBuild`",id:"afterbuild",depth:3,charIndex:-1},{text:"buildPlatform \u94A9\u5B50",id:"buildplatform-\u94A9\u5B50",depth:2,charIndex:713},{text:"`registerBuildPlatform`",id:"registerbuildplatform",depth:3,charIndex:-1},{text:"`beforeBuildPlatform`",id:"beforebuildplatform",depth:3,charIndex:-1},{text:"`buildPlatform`",id:"buildplatform",depth:3,charIndex:-1},{text:"`afterBuildPlatform`",id:"afterbuildplatform",depth:3,charIndex:-1},{text:"\u8C03\u8BD5\u94A9\u5B50",id:"\u8C03\u8BD5\u94A9\u5B50",depth:2,charIndex:1459},{text:"`registerDev`",id:"registerdev",depth:3,charIndex:-1},{text:"`beforeDev`",id:"beforedev",depth:3,charIndex:-1},{text:"`(before|after)DevMenu`",id:"beforeafterdevmenu",depth:3,charIndex:-1},{text:"`beforeDevTask`",id:"beforedevtask",depth:3,charIndex:-1},{text:"`afterDev`",id:"afterdev",depth:3,charIndex:-1}],frontmatter:{},version:"",_relativePath:"zh/api/plugin-api/plugin-hooks.md"},{title:"",routePath:"/module-tools/components/faq-build-exception",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-exception.mdx"},{title:"",routePath:"/module-tools/components/faq-build-other",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-other.mdx"},{title:"",routePath:"/module-tools/components/faq-build-product",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-build-product.mdx"},{title:"",routePath:"/module-tools/components/faq-storybook",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/faq-storybook.mdx"},{title:"",routePath:"/module-tools/components/publish-emo",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/publish-emo.mdx"},{title:"",routePath:"/module-tools/components/register-esbuild-plugin",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/register-esbuild-plugin.mdx"},{title:"",routePath:"/module-tools/components/release-module-doc",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/components/release-module-doc.mdx"},{title:"\u5904\u7406\u9759\u6001\u8D44\u6E90",routePath:"/module-tools/guide/advance/asset",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u884C\u4E3A",id:"\u9ED8\u8BA4\u884C\u4E3A",depth:2,charIndex:74},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:355}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/advance/asset.mdx"},{title:"\u6784\u5EFA umd \u4EA7\u7269",routePath:"/module-tools/guide/advance/build-umd",lang:"zh",toc:[{text:"umd \u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",id:"umd-\u4EA7\u7269\u7684\u7B2C\u4E09\u65B9\u4F9D\u8D56\u5904\u7406",depth:2,charIndex:181},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:302},{text:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u4E09\u65B9\u4F9D\u8D56\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:3,charIndex:556},{text:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",id:"\u66F4\u6539\u9879\u76EE\u7684\u5168\u5C40\u53D8\u91CF\u540D\u79F0",depth:2,charIndex:836}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/advance/build-umd.mdx"},{title:"\u4F7F\u7528 Copy \u5DE5\u5177",routePath:"/module-tools/guide/advance/copy",lang:"zh",toc:[{text:"\u4E86\u89E3 Copy API",id:"\u4E86\u89E3-copy-api",depth:2,charIndex:72},{text:"API \u8BE6\u89E3",id:"api-\u8BE6\u89E3",depth:2,charIndex:165},{text:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",id:"\u4E0D\u540C\u573A\u666F\u4F7F\u7528\u793A\u4F8B",depth:2,charIndex:826},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",id:"\u5C06\u6587\u4EF6\u590D\u5236\u6587\u4EF6",depth:3,charIndex:838},{text:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",id:"\u5C06\u6587\u4EF6\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:851},{text:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",id:"\u4ECE\u76EE\u5F55\u590D\u5236\u5230\u76EE\u5F55",depth:3,charIndex:865},{text:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",id:"\u4ECE\u76EE\u5F55\u5230\u6587\u4EF6",depth:3,charIndex:879},{text:"\u4F7F\u7528 Glob",id:"\u4F7F\u7528-glob",depth:3,charIndex:891}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/advance/copy.md"},{title:"\u5904\u7406\u4E09\u65B9\u4F9D\u8D56",routePath:"/module-tools/guide/advance/external-dependency",lang:"zh",toc:[{text:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",id:"\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406",depth:2,charIndex:264},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:521},{text:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",id:"\u6392\u9664\u6307\u5B9A\u7B2C\u4E09\u65B9\u4F9D\u8D56",depth:2,charIndex:652}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/advance/external-dependency.mdx"},{title:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA",routePath:"/module-tools/guide/advance/in-depth-about-build",lang:"zh",toc:[{text:"`bundle` / `bundleless`",id:"bundle--bundleless",depth:2,charIndex:-1},{text:"`input` / `sourceDir`",id:"input--sourcedir",depth:2,charIndex:-1},{text:"\u4F7F\u7528 swc",id:"\u4F7F\u7528-swc",depth:2,charIndex:1281},{text:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",id:"\u4F7F\u7528-hook-\u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B",depth:2,charIndex:1762},{text:"Hook \u7C7B\u578B",id:"hook-\u7C7B\u578B",depth:3,charIndex:1936},{text:"AsyncSeriesBailHook",id:"asyncseriesbailhook",depth:4,charIndex:1946},{text:"AsyncSeriesWaterFallHooks",id:"asyncserieswaterfallhooks",depth:4,charIndex:2048},{text:"Hook API",id:"hook-api",depth:3,charIndex:2117},{text:"load",id:"load",depth:4,charIndex:2128},{text:"transform",id:"transform",depth:4,charIndex:2236},{text:"renderChunk",id:"renderchunk",depth:4,charIndex:2358},{text:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",id:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210",depth:2,charIndex:2500},{text:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",id:"\u5173\u95ED\u7C7B\u578B\u751F\u6210",depth:3,charIndex:2542},{text:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",id:"\u6253\u5305\u7C7B\u578B\u6587\u4EF6",depth:3,charIndex:2619},{text:"\u522B\u540D\u8F6C\u6362",id:"\u522B\u540D\u8F6C\u6362",depth:3,charIndex:3090},{text:"\u4E00\u4E9B\u793A\u4F8B",id:"\u4E00\u4E9B\u793A\u4F8B",depth:3,charIndex:3208},{text:"\u6784\u5EFA\u8FC7\u7A0B",id:"\u6784\u5EFA\u8FC7\u7A0B",depth:2,charIndex:3220},{text:"\u6784\u5EFA\u62A5\u9519",id:"\u6784\u5EFA\u62A5\u9519",depth:2,charIndex:3394},{text:"\u8C03\u8BD5\u6A21\u5F0F",id:"\u8C03\u8BD5\u6A21\u5F0F",depth:2,charIndex:3567}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/advance/in-depth-about-build.md"},{title:"\u6DF1\u5165\u7406\u89E3 dev \u547D\u4EE4",routePath:"/module-tools/guide/advance/in-depth-about-dev-command",lang:"zh",toc:[{text:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",id:"\u547D\u4EE4\u8FD0\u884C\u7684\u6574\u4F53\u6D41\u7A0B",depth:2,charIndex:42},{text:"\u6269\u5C55 dev \u547D\u4EE4",id:"\u6269\u5C55-dev-\u547D\u4EE4",depth:2,charIndex:333}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/advance/in-depth-about-dev-command.md"},{title:"\u5F00\u59CB\u4E4B\u524D",routePath:"/module-tools/guide/basic/before-getting-started",lang:"zh",toc:[{text:"\u73AF\u5883\u51C6\u5907",id:"\u73AF\u5883\u51C6\u5907",depth:2,charIndex:3},{text:"\u521D\u8BC6 npm",id:"\u521D\u8BC6-npm",depth:2,charIndex:188},{text:"npm \u5305\u7C7B\u578B\u9879\u76EE",id:"npm-\u5305\u7C7B\u578B\u9879\u76EE",depth:2,charIndex:391},{text:"\u4F7F\u7528\u7B2C\u4E09\u65B9 npm \u5305",id:"\u4F7F\u7528\u7B2C\u4E09\u65B9-npm-\u5305",depth:2,charIndex:818},{text:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684 npm \u96F6\u788E\u77E5\u8BC6",id:"\u8FD8\u9700\u8981\u4E86\u89E3\u7684-npm-\u96F6\u788E\u77E5\u8BC6",depth:2,charIndex:1602},{text:"npm \u5305\u7684\u7A0B\u5E8F\u5165\u53E3",id:"npm-\u5305\u7684\u7A0B\u5E8F\u5165\u53E3",depth:3,charIndex:1621},{text:'"scripts"',id:"scripts",depth:3,charIndex:2042},{text:"`npm install`",id:"npm-install",depth:4,charIndex:-1},{text:"`npm publish`",id:"npm-publish",depth:4,charIndex:-1},{text:"peerDependencies",id:"peerdependencies",depth:3,charIndex:2825},{text:"npm \u5305\u7BA1\u7406\u5668",id:"npm-\u5305\u7BA1\u7406\u5668",depth:2,charIndex:3139},{text:"Modern.js Module \u914D\u7F6E\u6587\u4EF6",id:"modernjs-module-\u914D\u7F6E\u6587\u4EF6",depth:2,charIndex:3247}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/basic/before-getting-started.md"},{title:"CLI \u547D\u4EE4",routePath:"/module-tools/guide/basic/command-preview",lang:"zh",toc:[{text:"`modern build`",id:"modern-build",depth:2,charIndex:-1},{text:"`modern new`",id:"modern-new",depth:2,charIndex:-1},{text:"`modern dev`",id:"modern-dev",depth:2,charIndex:-1},{text:"`modern lint`",id:"modern-lint",depth:2,charIndex:-1},{text:"`modern change`",id:"modern-change",depth:2,charIndex:-1},{text:"`modern pre`",id:"modern-pre",depth:2,charIndex:-1},{text:"`modern bump`",id:"modern-bump",depth:2,charIndex:-1},{text:"`modern release`",id:"modern-release",depth:2,charIndex:-1},{text:"`modern gen-release-note`",id:"modern-gen-release-note",depth:2,charIndex:-1},{text:"`modern upgrade`",id:"modern-upgrade",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/basic/command-preview.md"},{title:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269",routePath:"/module-tools/guide/basic/modify-output-product",lang:"zh",toc:[{text:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",id:"\u9ED8\u8BA4\u8F93\u51FA\u4EA7\u7269",depth:2,charIndex:3},{text:"\u6784\u5EFA\u9884\u8BBE",id:"\u6784\u5EFA\u9884\u8BBE",depth:2,charIndex:344},{text:"\u6784\u5EFA\u914D\u7F6E",id:"\u6784\u5EFA\u914D\u7F6E",depth:2,charIndex:664},{text:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",id:"\u7ED3\u5408\u914D\u7F6E\u4E0E\u9884\u8BBE",depth:2,charIndex:1952}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/basic/modify-output-product.md"},{title:"\u7248\u672C\u7BA1\u7406\u4E0E\u53D1\u5E03",routePath:"/module-tools/guide/basic/publish-your-project",lang:"zh",toc:[{text:"\u8DDF\u8E2A\u53D8\u66F4",id:"\u8DDF\u8E2A\u53D8\u66F4",depth:2,charIndex:231},{text:"\u7248\u672C\u66F4\u65B0",id:"\u7248\u672C\u66F4\u65B0",depth:2,charIndex:519},{text:"\u53D1\u5E03",id:"\u53D1\u5E03",depth:2,charIndex:728},{text:"\u9884\u53D1\u5E03",id:"\u9884\u53D1\u5E03",depth:2,charIndex:1040}],frontmatter:{sidebar_position:7},version:"",_relativePath:"zh/guide/basic/publish-your-project.mdx"},{title:"\u4F7F\u7528\u5FAE\u751F\u6210\u5668",routePath:"/module-tools/guide/basic/use-micro-generator",lang:"zh",toc:[{text:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",id:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",depth:2,charIndex:166},{text:"Storybook \u8C03\u8BD5",id:"storybook-\u8C03\u8BD5",depth:2,charIndex:370},{text:"Tailwind CSS \u652F\u6301",id:"tailwind-css-\u652F\u6301",depth:2,charIndex:561},{text:"Modern.js Runtime API \u652F\u6301",id:"modernjs-runtime-api-\u652F\u6301",depth:2,charIndex:709}],frontmatter:{sidebar_position:4},version:"",_relativePath:"zh/guide/basic/use-micro-generator.md"},{title:"\u5F00\u53D1\u6A21\u5757\u6587\u6863",routePath:"/module-tools/guide/basic/use-module-doc",lang:"zh",toc:[{text:"\u5F00\u59CB\u4E4B\u524D",id:"\u5F00\u59CB\u4E4B\u524D",depth:2,charIndex:29},{text:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",id:"\u4E3A\u4EC0\u4E48\u6211\u4EEC\u9700\u8981\u4E3A\u6A21\u5757\u642D\u5EFA\u4E00\u4E2A\u6587\u6863\u7AD9\u70B9",depth:3,charIndex:37},{text:"\u524D\u7F6E\u51C6\u5907",id:"\u524D\u7F6E\u51C6\u5907",depth:3,charIndex:146},{text:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",id:"\u7AD9\u70B9\u57FA\u672C\u7ED3\u6784",depth:2,charIndex:233},{text:"\u914D\u7F6E\u4FA7\u8FB9\u680F",id:"\u914D\u7F6E\u4FA7\u8FB9\u680F",depth:3,charIndex:625},{text:"\u7F16\u5199\u6587\u6863",id:"\u7F16\u5199\u6587\u6863",depth:2,charIndex:830},{text:"\u7EC4\u4EF6\u9884\u89C8",id:"\u7EC4\u4EF6\u9884\u89C8",depth:2,charIndex:916},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:3,charIndex:973},{text:"\u79FB\u52A8\u7AEF\u9884\u89C8",id:"\u79FB\u52A8\u7AEF\u9884\u89C8",depth:3,charIndex:1216},{text:"\u4F7F\u7528\u5916\u90E8 demo",id:"\u4F7F\u7528\u5916\u90E8-demo",depth:3,charIndex:1369},{text:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",id:"\u4F7F\u7528\u5185\u7F6E\u7EC4\u4EF6",depth:2,charIndex:1461},{text:"API",id:"api",depth:3,charIndex:1505},{text:"\u89E3\u6790\u6587\u4EF6",id:"\u89E3\u6790\u6587\u4EF6",depth:4,charIndex:1525},{text:"\u5185\u5BB9\u751F\u6210",id:"\u5185\u5BB9\u751F\u6210",depth:4,charIndex:1563},{text:"\u7EC4\u4EF6\u4F7F\u7528",id:"\u7EC4\u4EF6\u4F7F\u7528",depth:4,charIndex:2032},{text:"Overview",id:"overview",depth:3,charIndex:2092},{text:"\u63D2\u4EF6\u914D\u7F6E",id:"\u63D2\u4EF6\u914D\u7F6E",depth:2,charIndex:2360},{text:"apiParseTool",id:"apiparsetool",depth:3,charIndex:2368},{text:"doc",id:"doc",depth:3,charIndex:2478},{text:"entries",id:"entries",depth:3,charIndex:2493},{text:"iframePosition",id:"iframeposition",depth:3,charIndex:2596},{text:"parseToolOptions",id:"parsetooloptions",depth:3,charIndex:2749},{text:"previewMode",id:"previewmode",depth:3,charIndex:2818},{text:"deprecated: languages",id:"deprecated-languages",depth:3,charIndex:2936},{text:"deprecated: useModuleSidebar",id:"deprecated-usemodulesidebar",depth:3,charIndex:3003},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:2,charIndex:3112},{text:"\u8FDB\u9636\u6307\u5357",id:"\u8FDB\u9636\u6307\u5357",depth:2,charIndex:3184}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/use-module-doc.mdx"},{title:"\u4F7F\u7528 Storybook",routePath:"/module-tools/guide/basic/using-storybook",lang:"zh",toc:[{text:"V7 (\u63A8\u8350)",id:"v7-\u63A8\u8350",depth:2,charIndex:239},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook",depth:3,charIndex:250},{text:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",id:"\u5F00\u542F\u4EA7\u7269\u8C03\u8BD5",depth:3,charIndex:492},{text:"\u5F00\u542F Rspack \u6784\u5EFA",id:"\u5F00\u542F-rspack-\u6784\u5EFA",depth:3,charIndex:946},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:3,charIndex:1095},{text:"bundler",id:"bundler",depth:4,charIndex:1134},{text:"builderConfig",id:"builderconfig",depth:4,charIndex:1222},{text:"\u547D\u4EE4\u884C",id:"\u547D\u4EE4\u884C",depth:3,charIndex:1356},{text:"storybook dev",id:"storybook-dev",depth:4,charIndex:1409},{text:"storybook build",id:"storybook-build",depth:4,charIndex:1444},{text:"\u914D\u7F6E\u6587\u4EF6",id:"\u914D\u7F6E\u6587\u4EF6",depth:3,charIndex:1490},{text:"\u4ECE V6 \u8FC1\u79FB\u81F3 V7",id:"\u4ECE-v6-\u8FC1\u79FB\u81F3-v7",depth:2,charIndex:1574},{text:"V6 (legacy)",id:"v6-legacy",depth:2,charIndex:2037},{text:"\u5F00\u542F Storybook",id:"\u5F00\u542F-storybook-1",depth:3,charIndex:2178},{text:"\u914D\u7F6E Storybook",id:"\u914D\u7F6E-storybook",depth:3,charIndex:2358},{text:"\u6784\u5EFA Storybook \u4EA7\u7269",id:"\u6784\u5EFA-storybook-\u4EA7\u7269",depth:3,charIndex:2705}],frontmatter:{sidebar_position:5},version:"",_relativePath:"zh/guide/basic/using-storybook.mdx"},{title:"\u5F00\u53D1\u7EC4\u4EF6",routePath:"/module-tools/guide/best-practices/components",lang:"zh",toc:[{text:"\u521D\u59CB\u5316\u9879\u76EE",id:"\u521D\u59CB\u5316\u9879\u76EE",depth:2,charIndex:40},{text:"\u4F7F\u7528 Storybook \u8C03\u8BD5\u4EE3\u7801",id:"\u4F7F\u7528-storybook-\u8C03\u8BD5\u4EE3\u7801",depth:2,charIndex:166},{text:"\u5F00\u53D1\u6837\u5F0F",id:"\u5F00\u53D1\u6837\u5F0F",depth:2,charIndex:227},{text:"CSS/PostCSS",id:"csspostcss",depth:3,charIndex:335},{text:"Less",id:"less",depth:3,charIndex:587},{text:"Sass/Scss",id:"sassscss",depth:3,charIndex:680},{text:"Tailwind CSS",id:"tailwind-css",depth:3,charIndex:784},{text:"CSS Modules",id:"css-modules",depth:3,charIndex:832},{text:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",id:"\u914D\u7F6E\u6784\u5EFA\u4EA7\u7269",depth:2,charIndex:1071},{text:"\u53D1\u5E03\u7EC4\u4EF6",id:"\u53D1\u5E03\u7EC4\u4EF6",depth:2,charIndex:1431}],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/best-practices/components.mdx"},{title:"\u4F7F\u7528 Tailwind CSS",routePath:"/module-tools/guide/best-practices/use-tailwindcss",lang:"zh",toc:[{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:2,charIndex:127},{text:"\u914D\u7F6E Tailwind CSS",id:"\u914D\u7F6E-tailwind-css",depth:2,charIndex:585},{text:"Tailwind CSS \u81EA\u52A8\u8865\u5168",id:"tailwind-css-\u81EA\u52A8\u8865\u5168",depth:2,charIndex:1047},{text:"\u6784\u5EFA\u6A21\u5F0F",id:"\u6784\u5EFA\u6A21\u5F0F",depth:2,charIndex:1360},{text:"Bundle \u6A21\u5F0F",id:"bundle-\u6A21\u5F0F",depth:3,charIndex:1477},{text:"Bundleless \u6A21\u5F0F",id:"bundleless-\u6A21\u5F0F",depth:3,charIndex:1660},{text:"\u7C7B\u540D\u524D\u7F00",id:"\u7C7B\u540D\u524D\u7F00",depth:2,charIndex:1732},{text:"\u7528\u6CD5\u4ECB\u7ECD",id:"\u7528\u6CD5\u4ECB\u7ECD",depth:2,charIndex:1890},{text:"HTML \u7C7B\u540D",id:"html-\u7C7B\u540D",depth:3,charIndex:1925},{text:"`@apply`",id:"apply",depth:3,charIndex:-1},{text:"Sass",id:"sass",depth:4,charIndex:2192},{text:"Less",id:"less",depth:4,charIndex:2300},{text:"\u5173\u4E8E `designSystem` \u914D\u7F6E",id:"\u5173\u4E8E-designsystem-\u914D\u7F6E",depth:2,charIndex:-1}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/best-practices/use-tailwindcss.mdx"},{title:"\u901A\u7528\u7C7B\u95EE\u9898",routePath:"/module-tools/guide/faq/basic",lang:"zh",toc:[{text:"Modern.js Module \u548C Rsbuild \u7684\u5173\u7CFB\uFF1F",id:"modernjs-module-\u548C-rsbuild-\u7684\u5173\u7CFB",depth:2,charIndex:3},{text:"Modern.js Module \u662F\u5426\u53EF\u4EE5\u4F7F\u7528 webpack plugin \u6216\u8005 loader?",id:"modernjs-module-\u662F\u5426\u53EF\u4EE5\u4F7F\u7528-webpack-plugin-\u6216\u8005-loader",depth:2,charIndex:103}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/basic.mdx"},{title:"\u6784\u5EFA\u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/build",lang:"zh",toc:[{text:"\u4EA7\u7269\u95EE\u9898",id:"\u4EA7\u7269\u95EE\u9898",depth:2,charIndex:110},{text:"Class Fields \u7684\u521D\u59CB\u5316\u5904\u7406",id:"class-fields-\u7684\u521D\u59CB\u5316\u5904\u7406",depth:3,charIndex:118},{text:"babel-plugin-lodash \u5C06\u5F15\u5165\u7684 lodash \u5904\u7406\u6210 `undefined`",id:"babel-plugin-lodash-\u5C06\u5F15\u5165\u7684-lodash-\u5904\u7406\u6210-undefined",depth:3,charIndex:-1},{text:"Cannot find module 'http'",id:"cannot-find-module-http",depth:3,charIndex:1337},{text:"\u5F02\u5E38\u7C7B\u95EE\u9898",id:"\u5F02\u5E38\u7C7B\u95EE\u9898",depth:2,charIndex:1559},{text:'Dynamic require of "react" is not supported',id:"dynamic-require-of-react-is-not-supported",depth:3,charIndex:1568},{text:"\u95EE\u9898\u63CF\u8FF0",id:"\u95EE\u9898\u63CF\u8FF0",depth:4,charIndex:1614},{text:"\u89E3\u51B3\u529E\u6CD5",id:"\u89E3\u51B3\u529E\u6CD5",depth:4,charIndex:1714},{text:"\u53C2\u8003\u94FE\u63A5",id:"\u53C2\u8003\u94FE\u63A5",depth:4,charIndex:1916},{text:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\uFF0C\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684 less \u6587\u4EF6\u62A5\u9519\uFF1A`'Operation on an invalid type'`",id:"\u7F16\u8BD1\u8FC7\u7A0B\u4E2D\u56E0\u4E3A\u67D0\u4E2A\u7EC4\u4EF6\u5E93\u7684-less-\u6587\u4EF6\u62A5\u9519operation-on-an-invalid-type",depth:3,charIndex:-1},{text:"Bundleless DTS failed",id:"bundleless-dts-failed",depth:3,charIndex:2338},{text:"Bundle DTS failed",id:"bundle-dts-failed",depth:3,charIndex:2595},{text:'`defineConfig` \u51FD\u6570\u7C7B\u578B\u62A5\u9519\uFF1A`\u5982\u679C\u6CA1\u6709\u5F15\u7528 "..."\uFF0C\u5219\u65E0\u6CD5\u547D\u540D "default" \u7684\u63A8\u65AD\u7C7B\u578B`',id:"defineconfig-\u51FD\u6570\u7C7B\u578B\u62A5\u9519\u5982\u679C\u6CA1\u6709\u5F15\u7528-\u5219\u65E0\u6CD5\u547D\u540D-default-\u7684\u63A8\u65AD\u7C7B\u578B",depth:3,charIndex:-1},{text:"\u5176\u4ED6",id:"\u5176\u4ED6",depth:2,charIndex:2940},{text:"bundleless \u5982\u4F55\u8DF3\u8FC7\u5BF9 less / scss \u6587\u4EF6\u7684\u9884\u5904\u7406",id:"bundleless-\u5982\u4F55\u8DF3\u8FC7\u5BF9-less--scss-\u6587\u4EF6\u7684\u9884\u5904\u7406",depth:3,charIndex:2946},{text:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",id:"\u589E\u52A0\u989D\u5916\u7684\u7F16\u8BD1\u80FD\u529B",depth:3,charIndex:3184},{text:"\u652F\u6301\u751F\u6210 CSS Modules \u7684 TypeScript \u58F0\u660E\u6587\u4EF6",id:"\u652F\u6301\u751F\u6210-css-modules-\u7684-typescript-\u58F0\u660E\u6587\u4EF6",depth:3,charIndex:3492}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/build.mdx"},{title:"\u5E38\u89C1\u95EE\u9898",routePath:"/module-tools/guide/faq/",lang:"zh",toc:[],frontmatter:{},version:"",_relativePath:"zh/guide/faq/index.md"},{title:"Storybook \u76F8\u5173\u95EE\u9898",routePath:"/module-tools/guide/faq/storybook",lang:"zh",toc:[{text:"\u652F\u6301 Storybook v7",id:"\u652F\u6301-storybook-v7",depth:2,charIndex:3},{text:"\u4F7F\u7528 Storybook Addon \u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",id:"\u4F7F\u7528-storybook-addon-\u6216\u8005\u5176\u4ED6\u914D\u7F6E\u4E0D\u751F\u6548",depth:2,charIndex:58},{text:"Cannot find module 'react-dom/package.json'",id:"cannot-find-module-react-dompackagejson",depth:2,charIndex:263},{text:"\u62A5\u9519\u540E\uFF0C\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",id:"\u62A5\u9519\u540E\u770B\u4E0D\u5230\u5177\u4F53\u62A5\u9519\u4FE1\u606F",depth:2,charIndex:373},{text:"Couldn't find any stories is your Storybook",id:"couldnt-find-any-stories-is-your-storybook",depth:2,charIndex:538},{text:"Storybook \u6DFB\u52A0 Proxy \u529F\u80FD",id:"storybook-\u6DFB\u52A0-proxy-\u529F\u80FD",depth:2,charIndex:696},{text:"Tailwind CSS \u5728 Storybook \u4E2D\u4E0D\u751F\u6548",id:"tailwind-css-\u5728-storybook-\u4E2D\u4E0D\u751F\u6548",depth:2,charIndex:918}],frontmatter:{},version:"",_relativePath:"zh/guide/faq/storybook.mdx"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/guide/intro/getting-started",lang:"zh",toc:[{text:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",id:"\u4E09\u5206\u949F\u5FEB\u901F\u4E0A\u624B",depth:2,charIndex:3},{text:"\u521B\u5EFA\u65B0\u9879\u76EE",id:"\u521B\u5EFA\u65B0\u9879\u76EE",depth:3,charIndex:110},{text:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",id:"\u63A5\u5165\u5DF2\u6709\u9879\u76EE",depth:3,charIndex:402},{text:"\u6838\u5FC3 npm \u5305",id:"\u6838\u5FC3-npm-\u5305",depth:3,charIndex:784},{text:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",id:"\u67E5\u770B\u5B98\u65B9\u793A\u4F8B",depth:3,charIndex:1118},{text:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",id:"\u8BA9\u6211\u4EEC\u5F00\u59CB\u5427",depth:2,charIndex:1175}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/guide/intro/getting-started.mdx"},{title:"\u6B22\u8FCE\u4F7F\u7528",routePath:"/module-tools/guide/intro/welcome",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/guide/intro/welcome.md"},{title:"\u4E3A\u4EC0\u4E48\u9700\u8981 Modern.js Module",routePath:"/module-tools/guide/intro/why-module-engineering-solution",lang:"zh",toc:[],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/guide/intro/why-module-engineering-solution.md"},{title:"index",routePath:"/module-tools/",lang:"zh",toc:[],frontmatter:{pageType:"home",hero:{name:"Modern.js Module",text:"\u6A21\u5757\u5DE5\u7A0B\u89E3\u51B3\u65B9\u6848",tagline:"\u7B80\u5355\u3001\u5F3A\u5927\u3001\u9AD8\u6027\u80FD\u7684\u73B0\u4EE3\u5316 npm \u5305\u5F00\u53D1\u65B9\u6848",actions:[{theme:"brand",text:"\u6B22\u8FCE\u4F7F\u7528",link:"/guide/intro/welcome"},{theme:"alt",text:"\u5FEB\u901F\u4E0A\u624B",link:"/guide/intro/getting-started"}]},features:[{title:"esbuild: \u9AD8\u6027\u80FD\u7684 JS Bundler",details:"\u57FA\u4E8E esbuild \u6784\u5EFA\uFF0C\u6784\u5EFA\u901F\u5EA6\u6781\u5FEB\uFF0C\u5E26\u7ED9\u4F60\u6781\u81F4\u7684\u5F00\u53D1\u4F53\u9A8C\u3002",icon:"\uD83D\uDE80"},{title:"\u53CC\u6784\u5EFA\u6A21\u5F0F",details:"\u652F\u6301 Bundle \u548C Bundleless \u4E24\u79CD\u6784\u5EFA\u6A21\u5F0F\u3002",icon:"\u2728"},{title:"\u5F00\u7BB1\u5373\u7528",details:"\u65E0\u9700\u8FC7\u591A\u914D\u7F6E\u5373\u53EF\u5F00\u53D1\u4F60\u7684 npm \u5305\uFF0C\u5185\u7F6E\u9884\u8BBE\u8986\u76D6\u591A\u79CD\u573A\u666F\u3002",icon:"\uD83D\uDEE0\uFE0F"},{title:"\u6269\u5C55\u6027\u5F3A: \u63D0\u4F9B\u5F3A\u5927\u7684\u63D2\u4EF6\u673A\u5236",details:"\u901A\u8FC7\u5176\u63D2\u4EF6\u6269\u5C55\u673A\u5236\uFF0C\u4F60\u53EF\u4EE5\u8F7B\u677E\u7684\u6269\u5C55 Modern.js Module \u7684\u5404\u9879\u80FD\u529B\u3002",icon:"\uD83C\uDFA8"},{title:"Storybook: \u793E\u533A\u6D41\u884C\u7684 UI \u5F00\u53D1\u5DE5\u5177",details:"\u96C6\u6210\u4E86 Storybook\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u5B83\u8C03\u8BD5 UI\u3002",icon:"\uD83D\uDCE6"},{title:"Lint: \u4EE3\u7801\u683C\u5F0F\u5316",details:"\u4E30\u5BCC\u573A\u666F\u7684\u5185\u7F6E ESLint \u89C4\u5219\u3002",icon:"\uD83D\uDCD0"}]},version:"",_relativePath:"zh/index.md"},{title:"\u5FEB\u901F\u5F00\u59CB",routePath:"/module-tools/plugins/guide/getting-started",lang:"zh",toc:[],frontmatter:{sidebar_position:1},version:"",_relativePath:"zh/plugins/guide/getting-started.mdx"},{title:"\u63D2\u4EF6\u5BF9\u8C61",routePath:"/module-tools/plugins/guide/plugin-object",lang:"zh",toc:[{text:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",id:"\u63D2\u4EF6\u7C7B\u578B\u5B9A\u4E49",depth:2,charIndex:245},{text:"\u63D2\u4EF6\u914D\u7F6E\u9879",id:"\u63D2\u4EF6\u914D\u7F6E\u9879",depth:2,charIndex:323}],frontmatter:{sidebar_position:2},version:"",_relativePath:"zh/plugins/guide/plugin-object.mdx"},{title:"Setup \u51FD\u6570",routePath:"/module-tools/plugins/guide/setup-function",lang:"zh",toc:[{text:"\u63D2\u4EF6 API \u5BF9\u8C61",id:"\u63D2\u4EF6-api-\u5BF9\u8C61",depth:2,charIndex:77},{text:"`api.useAppContext`",id:"apiuseappcontext",depth:3,charIndex:-1},{text:"`api.useResolvedConfigContext`",id:"apiuseresolvedconfigcontext",depth:3,charIndex:-1},{text:"`api.useHookRunners`",id:"apiusehookrunners",depth:3,charIndex:-1},{text:"\u5F02\u6B65 setup",id:"\u5F02\u6B65-setup",depth:2,charIndex:430},{text:"\u751F\u547D\u5468\u671F\u94A9\u5B50",id:"\u751F\u547D\u5468\u671F\u94A9\u5B50",depth:2,charIndex:579}],frontmatter:{sidebar_position:3},version:"",_relativePath:"zh/plugins/guide/setup-function.mdx"},{title:"\u603B\u89C8",routePath:"/module-tools/plugins/official-list/overview",lang:"zh",toc:[{text:"\u5B98\u65B9\u63D2\u4EF6",id:"\u5B98\u65B9\u63D2\u4EF6",depth:2,charIndex:3}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/overview.md"},{title:"Babel \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-babel",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:50},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:58},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:64},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:172}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-babel.mdx"},{title:"Banner \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-banner",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:132},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:140},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:146},{text:"\u793A\u4F8B",id:"\u793A\u4F8B",depth:2,charIndex:240},{text:"\u5728 JS \u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",id:"\u5728-js-\u6587\u4EF6\u9876\u90E8\u589E\u52A0\u7248\u6743\u4FE1\u606F",depth:3,charIndex:246},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:267},{text:"banner",id:"banner",depth:3,charIndex:283},{text:"footer",id:"footer",depth:3,charIndex:362}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-banner.mdx"},{title:"Import \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-import",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:144},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:152},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:158},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:245},{text:"pluginImport",id:"pluginimport",depth:3,charIndex:261},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:2,charIndex:357}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-import.mdx"},{title:"Node Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-node-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:213},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:221},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:227},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:274},{text:"exclude",id:"exclude",depth:3,charIndex:290},{text:"overrides",id:"overrides",depth:3,charIndex:326},{text:"Node Polyfills",id:"node-polyfills",depth:2,charIndex:363},{text:"Globals",id:"globals",depth:3,charIndex:381},{text:"Modules",id:"modules",depth:3,charIndex:464},{text:"Fallbacks",id:"fallbacks",depth:3,charIndex:860}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-node-polyfill.mdx"},{title:"Polyfill \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-polyfill",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:197},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:205},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:211},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:322},{text:"targets",id:"targets",depth:3,charIndex:338}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-polyfill.mdx"},{title:"Vue \u63D2\u4EF6",routePath:"/module-tools/plugins/official-list/plugin-vue",lang:"zh",toc:[{text:"\u5FEB\u901F\u5F00\u59CB",id:"\u5FEB\u901F\u5F00\u59CB",depth:2,charIndex:256},{text:"\u5B89\u88C5",id:"\u5B89\u88C5",depth:3,charIndex:264},{text:"\u6CE8\u518C\u63D2\u4EF6",id:"\u6CE8\u518C\u63D2\u4EF6",depth:3,charIndex:270},{text:"\u914D\u7F6E",id:"\u914D\u7F6E",depth:2,charIndex:317},{text:"vueJsxPluginOptions",id:"vuejsxpluginoptions",depth:3,charIndex:323}],frontmatter:{},version:"",_relativePath:"zh/plugins/official-list/plugin-vue.mdx"}],markdown:{showLineNumbers:!1,defaultWrapCode:!1,codeHighlighter:"prism"}}},4361:function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},9580:function(e,t,n){"use strict";n.d(t,{Zo:function(){return l},ah:function(){return a}});var i=n(2363);let r=i.createContext({});function a(e){let t=i.useContext(r);return i.useMemo(()=>"function"==typeof e?e(t):{...t,...e},[t,e])}let o={};function l({components:e,children:t,disableParentContext:n}){let l;return l=n?"function"==typeof e?e({}):e||o:a(e),i.createElement(r.Provider,{value:l},t)}},33:function(e,t,n){"use strict";n.d(t,{$U:function(){return th},E9:function(){return tv},Kw:function(){return td},_f:function(){return to},bw:function(){return tr},kv:function(){return te},lm:function(){return ta},mi:function(){return ts},pJ:function(){return tx},pZ:function(){return tu},rp:function(){return tt},t6:function(){return tn},tz:function(){return tg},xM:function(){return tp},xf:function(){return tc},yc:function(){return tf},yv:function(){return ti}});var i,r,a,o,l,s,d,c,u,h="object"==typeof global&&global&&global.Object===Object&&global,p="object"==typeof self&&self&&self.Object===Object&&self,m=h||p||Function("return this")(),f=m.Symbol,g=Object.prototype,x=g.hasOwnProperty,v=g.toString,b=f?f.toStringTag:void 0,y=function(e){var t=x.call(e,b),n=e[b];try{e[b]=void 0;var i=!0}catch(e){}var r=v.call(e);return i&&(t?e[b]=n:delete e[b]),r},w=Object.prototype.toString,k=f?f.toStringTag:void 0,j=function(e){var t;if(null==e)return void 0===e?"[object Undefined]":"[object Null]";return k&&k in Object(e)?y(e):(t=e,w.call(t))},I=function(e){return null!=e&&"object"==typeof e},P=Array.isArray,S=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},E=function(e){return e},C=function(e){if(!S(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},_=m["__core-js_shared__"];var N=(i=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",z=Function.prototype.toString,A=function(e){if(null!=e){try{return z.call(e)}catch(e){}try{return e+""}catch(e){}}return""},T=/^\[object .+?Constructor\]$/,O=Object.prototype,M=Function.prototype.toString,L=O.hasOwnProperty,R=RegExp("^"+M.call(L).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$=function(e){var t;return!!S(e)&&(t=e,!N||!(N in t))&&(C(e)?R:T).test(A(e))},B=function(e,t){var n,i,r=(n=e,i=t,null==n?void 0:n[i]);return $(r)?r:void 0},D=Object.create,H=function(){function e(){}return function(t){if(!S(t))return{};if(D)return D(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),F=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)},W=function(e,t){var n=-1,i=e.length;for(t||(t=Array(i));++n0){if(++a>=800)return arguments[0]}else a=0;return r.apply(void 0,arguments)}),G=/^(?:0|[1-9]\d*)$/,Z=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&G.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},ei=function(e){return null!=e&&en(e.length)&&!C(e)},er=function(e,t,n){if(!S(n))return!1;var i=typeof t;return("number"==i?!!(ei(n)&&Z(t,n.length)):"string"==i&&t in n)&&K(n[t],e)},ea=Object.prototype,eo=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ea)},el=function(e,t){for(var n=-1,i=Array(e);++n-1},eR.prototype.set=function(e,t){var n=this.__data__,i=eM(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var e$=B(m,"Map"),eB=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},eD=function(e,t){var n=e.__data__;return eB(t)?n["string"==typeof t?"string":"hash"]:n.map};function eH(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t1?t[i-1]:void 0,a=i>2?t[2]:void 0;for(r=u.length>3&&"function"==typeof r?(i--,r):void 0,a&&er(t[0],t[1],a)&&(r=i<3?void 0:r,i=1),e=Object(e);++n!0,tr=e=>e.replace(e9,"").replace(e8,"");function ta(e){return e.replace(/#.*$/,"")}var to=()=>!0;function tl(e){return"/"===e.charAt(0)||tc(e)?e:`/${e}`}function ts(e){return"/"===e.charAt(e.length-1)?e:`${e}/`}function td(e){var t;return"/"===(t=tl(function(e){let t=e.replace(/\\/g,"/"),n=t.startsWith("/"),i=t.split("/"),r=[];for(let e of i)"."===e||""===e||(".."===e?r.length>0&&".."!==r[r.length-1]?r.pop():n&&r.push(".."):r.push(e));let a=r.join("/");return n&&(a=`/${a}`),a}(e))).charAt(t.length-1)?t.slice(0,-1):t}function tc(e=""){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:")}function tu(e=""){return/^\s*data:/i.test(e)}function th(e,t,n,i="",r=!1,a=!1){let o=tv(e,i);(!o||a)&&(o=r?"/index":"/index.html"),o.endsWith("/")&&(o+=r?"/index":"/index.html");let l="",s="",d="",c=o.split("/").filter(Boolean);return n.current&&n.current!==n.default&&(l=c.shift()||""),t.target!==t.default?(s=t.target,t.current!==t.default&&c.shift()):c.shift(),d=c.join("/")||"",(l||s)&&!d&&(d=r?"index":"index.html"),tx(tl([l,s,d].filter(Boolean).join("/")),i)}function tp(e,t,n="",i=!1,r=!1){let a=tv(e,n);(!a||r)&&(a=i?"/index":"/index.html");let o="",l=a.split("/").filter(Boolean);t.target!==t.default?(o=t.target,t.current!==t.default&&l.shift()):l.shift();let s=l.join("/")||"";return o&&!s&&(s=i?"index":"index.html"),tx(tl([o,s].filter(Boolean).join("/")),n)}var tm=e=>{let[t,n=""]=e.split("#");return{url:t,hash:n}};function tf(e,t=!1){if(!e)return"/";if(tc(e))return e;let{url:n,hash:i}=tm(decodeURIComponent(e));return!t&&!n.endsWith(".html")&&(n.endsWith("/")?n+="index.html":n+=".html"),t&&n.endsWith("/")&&(n+="index"),t&&n.endsWith(".html")&&(n=n.replace(/\.html$/,"")),tl(i?`${n}#${i}`:n)}function tg(e,t=""){return tl(e).replace(td(t),"")}function tx(e="/",t=""){let n=tl(e),i=td(t);return n.startsWith(i)?n:`${i}${n}`}function tv(e,t){return tl(e).replace(RegExp(`^${td(t)}`),"")}},1411:function(e,t,n){"use strict";n.d(t,{YE:()=>ro,WG:()=>iv,ZB:()=>rs,Rg:()=>rc,KO:()=>iu,OK:()=>iQ,Ar:()=>nj,rU:()=>is,JL:()=>iM,Qn:()=>ng,RY:()=>nw,mi:()=>n5,BZ:()=>n8,xN:()=>np,Ct:()=>n1,zx:()=>n3,xK:()=>n9,mQ:()=>iJ,Vp:()=>ru,of:()=>rp,UQ:()=>tF,AV:()=>t8,tx:()=>tM,ls:()=>nr,ZP:()=>rm,TJ:()=>nX,zh:()=>na,s2:()=>no,H_:()=>nh,NG:()=>nl,VA:()=>nu,eF:()=>tH,cY:()=>tW,CU:()=>tR,CF:()=>t$,YS:()=>t7,Vl:()=>tB,M4:()=>tT,eE:()=>tq,WS:()=>tL,xB:()=>ir,Os:()=>nI,O9:()=>io,qx:()=>tA,g2:()=>iR,SU:()=>iW,Qe:()=>iU,y2:()=>t5,pU:()=>iG,ol:()=>i5,EG:()=>i4});var i,r,a,o,l,s,d,c,u,h,p,m,f,g,x,v,b,y,w,k,j,I,P,S,E,C={};n.r(C),n.d(C,{onSearch:()=>td}),n("909");let _=n("835"),N=n("7833"),z=n("9980");n("5311");let A=n("288"),T=n("2363"),O=n("8319"),M=n("1207"),L=n("6780"),{routes:R}=n(6118),$=(0,T.memo)(function(e){let t=e.el;return L.Z?.themeConfig?.enableContentAnimation&&(t=(0,_.n_)(e.el)),t},(e,t)=>e.el===t.el),B=({fallback:e=(0,z.jsx)(z.Fragment,{})})=>{let{pathname:t}=(0,O.TH)(),n=(0,M.fp)(R,(0,N.Tm)(t));if(!n)return(0,z.jsx)("div",{});let i=n[0].route.element;return(0,z.jsx)(T.Suspense,{fallback:e,children:(0,z.jsx)($,{el:i})})},D=n("9580");function H(e){let{children:t}=e,[n,i]=(0,T.useState)(!1);return((0,T.useEffect)(()=>{i(!0)},[]),n)?(0,z.jsx)(z.Fragment,{children:t}):null}let F=n("33"),W=n("5187"),q=n("5653"),U={"###en":"cbc2c9c5","###zh":"978b7149"},V=n("3371"),G=n("3393"),Z=/\s?|(]*>|]*>|]+>)+/i,Y=RegExp(G.map(e=>`<${e}\\b[^>]*>`).join("|"),"i"),K=n("4520");var J=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M4 6h24v2H4zm0 18h24v2H4zm0-12h24v2H4zm0 6h24v2H4z"})}),Q=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M22 16 12 26l-1.4-1.4 8.6-8.6-8.6-8.6L12 6z"})});function X(){return(X=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)continue;n[i]=e[i]}return n}function et(e,t){return(et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function en(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,et(e,t)}function ei(e,t){return e.replace(RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}let er=n("1850"),ea={disabled:!1},eo=T.createContext(null);var el=function(e){return e.scrollTop},es="unmounted",ed="exited",ec="entering",eu="entered",eh="exiting",ep=function(e){function t(t,n){i=e.call(this,t,n)||this;var i,r,a=n&&!n.isMounting?t.enter:t.appear;return i.appearStatus=null,t.in?a?(r=ed,i.appearStatus=ec):r=eu:r=t.unmountOnExit||t.mountOnEnter?es:ed,i.state={status:r},i.nextCallback=null,i}en(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===es?{status:ed}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==ec&&n!==eu&&(t=ec):(n===ec||n===eu)&&(t=eh)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,i=this.props.timeout;return e=t=n=i,null!=i&&"number"!=typeof i&&(e=i.exit,t=i.enter,n=void 0!==i.appear?i.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t){if(this.cancelNextCallback(),t===ec){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:er.findDOMNode(this);n&&el(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===ed&&this.setState({status:es})},n.performEnter=function(e){var t=this,n=this.props.enter,i=this.context?this.context.isMounting:e,r=this.props.nodeRef?[i]:[er.findDOMNode(this),i],a=r[0],o=r[1],l=this.getTimeouts(),s=i?l.appear:l.enter;if(!e&&!n||ea.disabled){this.safeSetState({status:eu},function(){t.props.onEntered(a)});return}this.props.onEnter(a,o),this.safeSetState({status:ec},function(){t.props.onEntering(a,o),t.onTransitionEnd(s,function(){t.safeSetState({status:eu},function(){t.props.onEntered(a,o)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:er.findDOMNode(this);if(!t||ea.disabled){this.safeSetState({status:ed},function(){e.props.onExited(i)});return}this.props.onExit(i),this.safeSetState({status:eh},function(){e.props.onExiting(i),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:ed},function(){e.props.onExited(i)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(i){n&&(n=!1,t.nextCallback=null,e(i))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:er.findDOMNode(this),i=null==e&&!this.props.addEndListener;if(!n||i){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var r=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=r[0],o=r[1];this.props.addEndListener(a,o)}null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===es)return null;var t=this.props,n=t.children,i=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,ee(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return T.createElement(eo.Provider,{value:null},"function"==typeof n?n(e,i):T.cloneElement(T.Children.only(n),i))},t}(T.Component);function em(){}ep.contextType=eo,ep.propTypes={},ep.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:em,onEntering:em,onEntered:em,onExit:em,onExiting:em,onExited:em},ep.UNMOUNTED=es,ep.EXITED=ed,ep.ENTERING=ec,ep.ENTERED=eu,ep.EXITING=eh;var ef=function(e,t){return e&&t&&t.split(" ").forEach(function(t){var n,i;return n=e,i=t,void(n.classList?n.classList.remove(i):"string"==typeof n.className?n.className=ei(n.className,i):n.setAttribute("class",ei(n.className&&n.className.baseVal||"",i)))})},eg=function(e){function t(){for(var t,n=arguments.length,i=Array(n),r=0;r(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 7H3V5h13v2M3 19h13v-2H3v2m19-7-4-3v2H3v2h15v2l4-3Z"})}),ev=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"#22a041",d:"M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"})});let eb={javascript:["js"],markdown:["md"],tsx:["mdx"],typescript:["ts"]},ey={bash:n(4251).default,css:n(273).default,diff:n(4580).default,javascript:n(6586).default,json:n(8960).default,less:n(1107).default,markdown:n(9159).default,sass:n(6929).default,scss:n(8831).default,tsx:n(9549).default,typescript:n(6397).default};function ew(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return(function(e){if(0===e.length||1===e.length)return e;var t,n,i=e.join(".");if(!eS[i]){;eS[i]=0===(n=(t=e).length)||1===n?t:2===n?[t[0],t[1],"".concat(t[0],".").concat(t[1]),"".concat(t[1],".").concat(t[0])]:3===n?[t[0],t[1],t[2],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0])]:n>=4?[t[0],t[1],t[2],t[3],"".concat(t[0],".").concat(t[1]),"".concat(t[0],".").concat(t[2]),"".concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[0]),"".concat(t[1],".").concat(t[2]),"".concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[1]),"".concat(t[2],".").concat(t[3]),"".concat(t[3],".").concat(t[0]),"".concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[0]),"".concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[0],".").concat(t[1],".").concat(t[2],".").concat(t[3]),"".concat(t[0],".").concat(t[1],".").concat(t[3],".").concat(t[2]),"".concat(t[0],".").concat(t[2],".").concat(t[1],".").concat(t[3]),"".concat(t[0],".").concat(t[2],".").concat(t[3],".").concat(t[1]),"".concat(t[0],".").concat(t[3],".").concat(t[1],".").concat(t[2]),"".concat(t[0],".").concat(t[3],".").concat(t[2],".").concat(t[1]),"".concat(t[1],".").concat(t[0],".").concat(t[2],".").concat(t[3]),"".concat(t[1],".").concat(t[0],".").concat(t[3],".").concat(t[2]),"".concat(t[1],".").concat(t[2],".").concat(t[0],".").concat(t[3]),"".concat(t[1],".").concat(t[2],".").concat(t[3],".").concat(t[0]),"".concat(t[1],".").concat(t[3],".").concat(t[0],".").concat(t[2]),"".concat(t[1],".").concat(t[3],".").concat(t[2],".").concat(t[0]),"".concat(t[2],".").concat(t[0],".").concat(t[1],".").concat(t[3]),"".concat(t[2],".").concat(t[0],".").concat(t[3],".").concat(t[1]),"".concat(t[2],".").concat(t[1],".").concat(t[0],".").concat(t[3]),"".concat(t[2],".").concat(t[1],".").concat(t[3],".").concat(t[0]),"".concat(t[2],".").concat(t[3],".").concat(t[0],".").concat(t[1]),"".concat(t[2],".").concat(t[3],".").concat(t[1],".").concat(t[0]),"".concat(t[3],".").concat(t[0],".").concat(t[1],".").concat(t[2]),"".concat(t[3],".").concat(t[0],".").concat(t[2],".").concat(t[1]),"".concat(t[3],".").concat(t[1],".").concat(t[0],".").concat(t[2]),"".concat(t[3],".").concat(t[1],".").concat(t[2],".").concat(t[0]),"".concat(t[3],".").concat(t[2],".").concat(t[0],".").concat(t[1]),"".concat(t[3],".").concat(t[2],".").concat(t[1],".").concat(t[0])]:void 0}return eS[i]})(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return eP(eP({},e),n[t])},t)}(o.className,Object.assign({},o.style,void 0===i?{}:i),n)})}else p=eP(eP({},o),{},{className:o.className.join(" ")});var v=m(t.children);return T.createElement(s,X({key:a},p),v)}}var e_=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function eN(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ez(e){for(var t=1;t=0||({}).propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,e_);O=O||i;var L=m?T.createElement(eT,{containerStyle:b,codeStyle:c.style||{},numberStyle:w,startingLineNumber:v,codeString:A}):null,R=o.hljs||o['pre[class*="language-"]']||{backgroundColor:"#fff"},$=e$(O)?"hljs":"prismjs",B=h?Object.assign({},M,{style:Object.assign({},R,s)}):Object.assign({},M,{className:M.className?"".concat($," ").concat(M.className):$,style:Object.assign({},s)});if(I?c.style=ez(ez({},c.style),{},{whiteSpace:"pre-wrap"}):c.style=ez(ez({},c.style),{},{whiteSpace:"pre"}),!O)return T.createElement(C,B,L,T.createElement(N,c,A));(void 0===k&&S||I)&&(k=!0),S=S||eR;var D=[{type:"text",value:A}],H=function(e){var t=e.astGenerator,n=e.language,i=e.code,r=e.defaultCodeValue;if(e$(t)){var a,o,l=(a=t,o=n,-1!==a.listLanguages().indexOf(o));return"text"===n?{value:r,language:"text"}:l?t.highlight(n,i):t.highlightAuto(i)}try{return n&&"text"!==n?{value:t.highlight(i,n)}:{value:r}}catch(e){return{value:r}}}({astGenerator:O,language:t,code:A,defaultCodeValue:D});null===H.language&&(H.value=D);var F=H.value.length+v,W=function(e,t,n,i,r,a,o,l,s){var d,c=function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=0;r2&&void 0!==arguments[2]?arguments[2]:[];return t||d.length>0?function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return eL({children:e,lineNumber:t,lineNumberStyle:l,largestLineNumber:o,showInlineLineNumbers:r,lineProps:n,className:a,showLineNumbers:i,wrapLongLines:s})}(e,a,d):function(e,t){if(i&&t&&r){var n=eM(l,t,o);e.unshift(eO(t,n))}return e}(e,a)}for(;p(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 30 30",...e,children:[(0,z.jsx)("path",{fill:"currentColor",d:"M28 10v18H10V10h18m0-2H10a2 2 0 0 0-2 2v18a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M4 18H2V4a2 2 0 0 1 2-2h14v2H4Z"})]}),eq=e=>(0,z.jsx)("svg",{width:32,height:32,viewBox:"0 0 30 30",...e,children:(0,z.jsx)("path",{fill:"#49cd37",d:"m13 24-9-9 1.414-1.414L13 21.171 26.586 7.586 28 9 13 24z"})});let eU=n("7841"),eV=n("6118");var eG=e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32",...e,children:[(0,z.jsx)("circle",{cx:8,cy:16,r:2,fill:"currentColor"}),(0,z.jsx)("circle",{cx:16,cy:16,r:2,fill:"currentColor"}),(0,z.jsx)("circle",{cx:24,cy:16,r:2,fill:"currentColor"})]}),eZ=!1;if("undefined"!=typeof window){var eY={get passive(){eZ=!0;return}};window.addEventListener("testPassive",null,eY),window.removeEventListener("testPassive",null,eY)}var eK="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1),eJ=[],eQ=!1,eX=-1,e0=void 0,e1=void 0,e2=void 0,e3=function(e){return eJ.some(function(t){return!!(t.options.allowTouchMove&&t.options.allowTouchMove(e))||!1})},e4=function(e){var t=e||window.event;return!!e3(t.target)||!!(t.touches.length>1)||(t.preventDefault&&t.preventDefault(),!1)},e5=function(e){if(void 0===e2){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;if(t&&n>0){var i=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right"),10);e2=document.body.style.paddingRight,document.body.style.paddingRight=i+n+"px"}}void 0===e0&&(e0=document.body.style.overflow,document.body.style.overflow="hidden")},e6=function(){void 0!==e2&&(document.body.style.paddingRight=e2,e2=void 0),void 0!==e0&&(document.body.style.overflow=e0,e0=void 0)},e7=function(){if(void 0!==e1){var e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);document.body.style.position=e1.position,document.body.style.top=e1.top,document.body.style.left=e1.left,window.scrollTo(t,e),e1=void 0}},e8=function(e,t){var n,i=e.targetTouches[0].clientY-eX;if(e3(e.target))return!1;if(t&&0===t.scrollTop&&i>0)return e4(e);return(n=t)&&n.scrollHeight-n.scrollTop<=n.clientHeight&&i<0?e4(e):(e.stopPropagation(),!0)},e9=function(e,t){if(!e){console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");return}if(!eJ.some(function(t){return t.targetElement===e}))eJ=[].concat(function(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t=i&&(document.body.style.top=-(t+e))})},300)}}):e5(t),eK&&(e.ontouchstart=function(e){1===e.targetTouches.length&&(eX=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&e8(t,e)},!eQ&&(document.addEventListener("touchmove",e4,eZ?{passive:!1}:void 0),eQ=!0))},te=function(){eK&&(eJ.forEach(function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null}),eQ&&(document.removeEventListener("touchmove",e4,eZ?{passive:!1}:void 0),eQ=!1),eX=-1),eK?e7():e6(),eJ=[]},tt=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{d:"M12 18c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6zm0-10c-2.2 0-4 1.8-4 4s1.8 4 4 4 4-1.8 4-4-1.8-4-4-4zM12 4c-.6 0-1-.4-1-1V1c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM12 24c-.6 0-1-.4-1-1v-2c0-.6.4-1 1-1s1 .4 1 1v2c0 .6-.4 1-1 1zM5.6 6.6c-.3 0-.5-.1-.7-.3L3.5 4.9c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.1.2-.4.3-.7.3zM19.8 20.8c-.3 0-.5-.1-.7-.3l-1.4-1.4c-.4-.4-.4-1 0-1.4s1-.4 1.4 0l1.4 1.4c.4.4.4 1 0 1.4-.2.2-.5.3-.7.3zM3 13H1c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM23 13h-2c-.6 0-1-.4-1-1s.4-1 1-1h2c.6 0 1 .4 1 1s-.4 1-1 1zM4.2 20.8c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.4.3-.7.3zM18.4 6.6c-.3 0-.5-.1-.7-.3-.4-.4-.4-1 0-1.4l1.4-1.4c.4-.4 1-.4 1.4 0s.4 1 0 1.4l-1.4 1.4c-.2.2-.5.3-.7.3z"})}),tn=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{d:"M12.1 22h-.9c-5.5-.5-9.5-5.4-9-10.9.4-4.8 4.2-8.6 9-9 .4 0 .8.2 1 .5.2.3.2.8-.1 1.1-2 2.7-1.4 6.4 1.3 8.4 2.1 1.6 5 1.6 7.1 0 .3-.2.7-.3 1.1-.1.3.2.5.6.5 1-.2 2.7-1.5 5.1-3.6 6.8-1.9 1.4-4.1 2.2-6.4 2.2zM9.3 4.4c-2.9 1-5 3.6-5.2 6.8-.4 4.4 2.8 8.3 7.2 8.7 2.1.2 4.2-.4 5.8-1.8 1.1-.9 1.9-2.1 2.4-3.4-2.5.9-5.3.5-7.5-1.1-2.8-2.2-3.9-5.9-2.7-9.2z"})}),ti=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})}),tr=e=>(0,z.jsx)("svg",{width:18,height:18,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M27.85 29H30l-6-15h-2.35l-6 15h2.15l1.6-4h6.85zm-7.65-6 2.62-6.56L25.45 23zM18 7V5h-7V2H9v3H2v2h10.74a14.71 14.71 0 0 1-3.19 6.18A13.5 13.5 0 0 1 7.26 9h-2.1a16.47 16.47 0 0 0 3 5.58A16.84 16.84 0 0 1 3 18l.75 1.86A18.47 18.47 0 0 0 9.53 16a16.92 16.92 0 0 0 5.76 3.84L16 18a14.48 14.48 0 0 1-5.12-3.37A17.64 17.64 0 0 0 14.8 7z"})}),ta=e=>(0,z.jsx)("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"})}),to=e=>(0,z.jsx)("svg",{width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"var(--rp-c-gray)",d:"m29 27.586-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9 9.01 9.01 0 0 1-9-9Z"})});let tl=n("4154"),ts=n("1716"),td=()=>{};var tc=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M24 9.4 22.6 8 16 14.6 9.4 8 8 9.4l6.6 6.6L8 22.6 9.4 24l6.6-6.6 6.6 6.6 1.4-1.4-6.6-6.6L24 9.4z"})}),tu=e=>(0,z.jsx)("svg",{width:32,height:32,viewBox:"0 0 24 24",...e,children:(0,z.jsxs)("g",{fill:"none",stroke:"var(--rp-c-brand)",strokeLinecap:"round",strokeWidth:2,children:[(0,z.jsx)("path",{strokeDasharray:60,strokeDashoffset:60,strokeOpacity:.3,d:"M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Z",children:(0,z.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"1.3s",values:"60;0"})}),(0,z.jsxs)("path",{strokeDasharray:15,strokeDashoffset:15,d:"M12 3a9 9 0 0 1 9 9",children:[(0,z.jsx)("animate",{fill:"freeze",attributeName:"stroke-dashoffset",dur:"0.3s",values:"15;0"}),(0,z.jsx)("animateTransform",{attributeName:"transform",dur:"1.5s",repeatCount:"indefinite",type:"rotate",values:"0 12 12;360 12 12"})]})]})}),th=e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:48,height:48,fill:"none",viewBox:"0 0 48 48",...e,children:[(0,z.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M24 5v6m7 1 4-4m-18 4-4-4m27 33H8a2 2 0 0 1-2-2v-8.46a2 2 0 0 1 .272-1.007l6.15-10.54A2 2 0 0 1 14.148 18H33.85a2 2 0 0 1 1.728.992l6.149 10.541A2 2 0 0 1 42 30.541V39a2 2 0 0 1-2 2Z"}),(0,z.jsx)("path",{stroke:"currentColor",strokeWidth:4,d:"M41.5 30H28s-1 3-4 3-4-3-4-3H6.5"})]}),tp=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M13.414 17.586 18 22.172V8H8V6h10a2.002 2.002 0 0 1 2 2v14.172l4.586-4.586L26 19l-7 7-7-7Z"})}),tm=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",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"})}),tf=e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"m21.94 13.11-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91-6.17-7.91m8.73 7.92 2.47-7.59.1-.33h3.61l-5.59 7.16m4.1-13.67 1.81 5.56h-3.62m-1.3.95-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94 7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43 5.82 7.45m11.38-4.73-6.51 4.73.02-.03 5.79-7.42.79 2.43c.04.1 0 .22-.09.29"})}),tg=Object.defineProperty,tx=Object.defineProperties,tv=Object.getOwnPropertyDescriptors,tb=Object.getOwnPropertySymbols,ty=Object.prototype.hasOwnProperty,tw=Object.prototype.propertyIsEnumerable,tk=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tj=(e,t)=>{for(var n in t||(t={}))ty.call(t,n)&&tk(e,n,t[n]);if(tb)for(var n of tb(t))tw.call(t,n)&&tk(e,n,t[n]);return e},tI=(e,t)=>tx(e,tv(t)),tP=(e,t)=>{var n={};for(var i in e)ty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&tb)for(var i of tb(e))0>t.indexOf(i)&&tw.call(e,i)&&(n[i]=e[i]);return n},tS=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},tE=(e,t,n)=>(tS(e,t,"read from private field"),n?n.call(e):t.get(e)),tC=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},t_=(e,t,n,i)=>(tS(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n),tN=(e,t,n)=>(tS(e,t,"access private method"),n),tz=(e,t,n)=>new Promise((i,r)=>{var a=e=>{try{l(n.next(e))}catch(e){r(e)}},o=e=>{try{l(n.throw(e))}catch(e){r(e)}},l=e=>e.done?i(e.value):Promise.resolve(e.value).then(a,o);l((n=n.apply(e,t)).next())});function tA(){let{siteData:e,page:t}=(0,_.Vi)(),n=e.lang,i=e.multiVersion.default;if(n&&"undefined"!=typeof window&&location.pathname.includes(`/${n}/`)){let e=location.pathname.replace(`/${n}/`,"/");return window.location.replace(e),(0,z.jsx)(z.Fragment,{})}let r="/";return i&&t.version!==i&&(r+=`${t.version}/`),n&&t.lang!==n&&(r+=`${t.lang}/`),(0,z.jsxs)("div",{className:"m-auto mt-50 p-16 sm:p-8 sm:pt-24 sm:pb-40 text-center flex-center flex-col",children:[(0,z.jsx)("p",{className:"text-6xl font-semibold",children:"404"}),(0,z.jsx)("h1",{className:"leading-5 pt-3 text-xl font-bold",children:"PAGE NOT FOUND"}),(0,z.jsx)("div",{style:{height:"1px"},className:"mt-6 mx-auto mb-4.5 w-16 bg-gray-light-1"}),(0,z.jsx)("div",{className:"pt-5",children:(0,z.jsx)("a",{className:"py-2 px-4 rounded-2xl inline-block border-solid border-brand text-brand font-medium hover:border-brand-dark hover:text-brand-dark transition-colors duration-300",href:(0,N.pJ)(r),"aria-label":"go to home",children:"Take me home"})})]})}function tT(){var e,t,n;let i=(0,_.Vi)(),{page:{lang:r}}=i,a=null!=(t=null==(e=null==i?void 0:i.siteData)?void 0:e.themeConfig)?t:{},o=null!=(n=i.siteData.lang)?n:"",l=null==a?void 0:a.locales;return l&&0!==l.length?tI(tj({},l.find(e=>e.lang===r)),{langRoutePrefix:r===o?"/":r}):{nav:a.nav,sidebar:a.sidebar,prevPageText:a.prevPageText,nextPageText:a.nextPageText,sourceCodeText:a.sourceCodeText,searchPlaceholderText:a.searchPlaceholderText,searchNoResultsText:a.searchNoResultsText,searchSuggestedQueryText:a.searchSuggestedQueryText}}var tO=(e,t)=>{let n;for(let i of Object.keys(e)){if(n&&n!==i)continue;if((0,N.pV)((0,N.pJ)(i),t))return{group:"Documentation",items:e[i]};let r=e[i].find(r=>{let a=r=>{if(!t.startsWith((0,N.pJ)(i))){for(let r of Object.keys(e))if(r!==i&&t.startsWith((0,F.mi)((0,N.pJ)(r))))return n=r,!1}let o=()=>"link"in r&&(0,N.pV)((0,N.pJ)(r.link),t);if("items"in r)return!!o()||r.items.some(e=>a(e));return o()};return a(r)});if(r){let t=e[i];return{group:"text"in r&&r.text||"",items:t}}}return{group:"Documentation",items:[]}};function tM(){var e;let t=tT(),n=null!=(e=t.sidebar)?e:{},{pathname:i}=(0,O.TH)(),r=decodeURIComponent(i),[a,o]=(0,T.useState)(tO(n,r));return(0,T.useEffect)(()=>{o(tO(n,r))},[r,t.lang]),a}function tL(){let{pathname:e}=(0,O.TH)(),{items:t}=tM(),n=[],i=e=>{"items"in e?(e.link&&n.push({text:e.text,link:e.link}),e.items.forEach(e=>{"dividerType"in e||i(e)})):n.push(e)};t.forEach(e=>!("dividerType"in e)&&i(e));let r=n.findIndex(t=>(0,N.pV)((0,N.pJ)(t.link),e)),a=n[r-1]||null;return{prevPage:a,nextPage:n[r+1]||null}}function tR(){var e,t,n;let{siteData:i,page:r}=(0,_.Vi)(),a=null!=(n=null!=(t=tT().editLink)?t:null==(e=i.themeConfig)?void 0:e.editLink)?n:{};if(!a.docRepoBaseUrl||!a.text)return null;let{docRepoBaseUrl:o}=a;!o.endsWith("/")&&(o+="/");let l=r._relativePath.replace(/\\/g,"/"),s=`${o}${l}`;return{text:a.text,link:s}}function t$(){var e;let{siteData:{themeConfig:t},page:{frontmatter:n={}}}=(0,_.Vi)(),i=(null==(e=null==n?void 0:n.navbar)||e)&&(null==t?void 0:t.hideNavbar)!=="always",[r,a]=(0,T.useState)(i);return[r,a]}function tB(){var e;let{siteData:{themeConfig:t}}=(0,_.Vi)(),n=null!=(e=t.hideNavbar)?e:"never",[i,r]=(0,T.useState)(!1),{pathname:a}=(0,O.TH)(),o=(0,T.useRef)(0);return"never"!==n&&("always"===n||((0,T.useEffect)(()=>{r(!1);let e=(0,W.Z)(()=>{let{scrollTop:e}=document.documentElement;if(e!==o.current)r(o.current>0&&e-o.current>0),o.current=e<=0?0:e},200);return window.addEventListener("mousewheel",e),window.addEventListener("touchmove",e),()=>{window.removeEventListener("mousewheel",e),window.removeEventListener("touchmove",e)}},[a]),i))}function tD(e,t=72){let n=Number.parseInt(window.getComputedStyle(e).paddingTop,10);return Math.round(window.scrollY+e.getBoundingClientRect().top-t-n)}function tH(e,t,n=72){window.scrollTo(tj({left:0,top:tD(e,n)},t?{behavior:"smooth"}:{}))}function tF(){let e=document.getElementById("aside-container"),t=Array.from(document.querySelectorAll(".rspress-doc .header-anchor")).filter(e=>{var t;return(null==(t=e.parentElement)?void 0:t.tagName)!=="H1"});if(!e||!t.length)return;let n=null;if(!Array.from((null==e?void 0:e.getElementsByTagName("a"))||[]).map(e=>decodeURIComponent(e.hash)).length)return;let i=(t,i)=>{if(t[i]){let r=t[i].getAttribute("href"),a=null==e?void 0:e.querySelector(`a[href="#${null==r?void 0:r.slice(1)}"] > span`);a&&(n&&n.classList.remove("aside-active"),(n=a).classList.add("aside-active"))}},r=()=>{if(document.documentElement.scrollTop+window.innerHeight>=document.documentElement.scrollHeight)i(t,t.length-1);else for(let e=0;e=o&&a{n&&n.classList.remove("aside-active"),window.removeEventListener("scroll",a)}}function tW(){if(!!(0,F._f)())window.addEventListener("click",e=>{let t=e.target.closest("a");if(t){let{origin:n,hash:i,target:r,pathname:a,search:o}=t,l=window.location;i&&"_blank"!==r&&n===l.origin&&(a===l.pathname&&o===l.search&&i&&t.classList.contains("header-anchor")?(e.preventDefault(),history.pushState(null,"",i),!function(e,t,n=!1){let i=null;try{i=e.classList.contains("header-anchor")?e:document.getElementById(decodeURIComponent(t.slice(1)))}catch(e){console.warn(e)}i&&tH(i,n)}(t,i,!0),window.dispatchEvent(new Event("hashchange"))):window.addEventListener("RspressReloadContent",()=>{location.hash.length>1&&tH(document.getElementById(location.hash.slice(1)),!1)}))}},{capture:!0}),window.addEventListener("hashchange",e=>{e.preventDefault()})}function tq(){let e=(0,_.Jr)(),t=(0,_.aw)(),n=(0,_.Vi)(),i=n.siteData.lang,r=n.siteData.multiVersion.default;return{normalizeLinkHref:n=>{let a=n;if((i||r)&&!(0,F.xf)(a)&&!a.startsWith("#")){let n=(a=(0,N.E9)(a)).split("/").filter(Boolean),o="",l="",s="";return r&&(t!==r?(o=t,n[0]===t&&n.shift()):n[0]===r&&n.shift()),i&&(e!==i?(l=e,n[0]===e&&n.shift()):n[0]===i&&n.shift()),s=n.join("/"),(0,N.AP)((0,N.pJ)([o,l,s].filter(Boolean).join("/")))}return a}}}var tU="default",tV=/[\u3131-\u314e|\u314f-\u3163|\uac00-\ud7a3]/u,tG=/[\u0400-\u04FF]/u;function tZ(e){let t=e.toString().toLowerCase().normalize("NFD"),n=t.replace(/[\u0300-\u036f]/g,"");return tG.test(String(e))?t.normalize("NFC"):tV.test(String(e))?n.normalize("NFC"):n}function tY(e){return e.replace(/https?:\/\/[^/]+/,"")}function tK(e){return e.charCodeAt(0)>255?3:1}var tJ=e=>e.map(e=>"string"==typeof e?{value:e,label:e}:e);function tQ(e,t){let n=0,i=0;for(let r=0;r=t);r++){;i+=tK(e.charAt(r)),n++}return n}function tX(e){let t=0;for(let n=0;ntI(tj({},e),{normalizedContent:tZ(e.content),headers:e.toc.map(e=>tZ(e.text)).join(" "),normalizedTitle:tZ(e.title)})),a={tokenize:"full",async:!0,doc:{id:"routePath",field:["normalizedTitle","headers","normalizedContent"]},cache:100,split:/\W+/};t_(this,o,q.create(a)),t_(this,l,q.create(tI(tj({},a),{tokenize:e=>t2(e,t0)}))),t_(this,s,q.create(tI(tj({},a),{tokenize:e=>t2(e,t1)}))),tE(this,o).add(r),tE(this,l).add(r),tE(this,s).add(r)})}search(e){return tz(this,null,function*(){var t,n;let{keyword:i,limit:r}=e,a={query:i,limit:r,field:["normalizedTitle","headers","normalizedContent"]},d=(yield Promise.all([null==(t=tE(this,o))?void 0:t.search(a),null==(n=tE(this,l))?void 0:n.search(a),tE(this,s).search(a)])).flat(2).filter(Boolean);return[{index:tU,hits:Array.from(new Set(d.map(e=>e.id))).map(e=>d.find(t=>t.id===e))}]})}};o=new WeakMap,l=new WeakMap,s=new WeakMap,d=new WeakSet,c=function(e,t){return tz(this,null,function*(){let n=`${t}###${e}`,i=t?`.${t.replace(".","_")}`:"",r=e?`.${e}`:"";return(yield fetch(`/module-tools/static/${F.t6}${i}${r}.${U[n]}.json`)).json()})};var t4=class{constructor(){tC(this,u,void 0)}init(e){return tz(this,null,function*(){t_(this,u,e)})}search(e){return tz(this,null,function*(){let{apiUrl:t,searchIndexes:n}=tE(this,u),{keyword:i,limit:r}=e,a=Object.entries({keyword:i,limit:r.toString(),searchIndexes:(null==n?void 0:n.map(e=>"string"==typeof e?e:e.value).join(","))||"",lang:tE(this,u).currentLang}).map(e=>e.map(encodeURIComponent).join("=")).join("&");try{return(yield fetch(`${t}?${a}`)).json()}catch(e){return console.error(e),[]}})}};u=new WeakMap;var t5=((a=t5||{}).Default="default",a.Custom="custom",a),t6=class{constructor(e){if(tC(this,f),tC(this,x),tC(this,b),tC(this,w),tC(this,j),tC(this,P),tC(this,h,void 0),tC(this,p,tU),tC(this,m,void 0),t_(this,h,e),t_(this,p,e.indexName),"remote"===e.mode)t_(this,m,new t4);else t_(this,m,new t3)}init(){return tz(this,null,function*(){var e;yield null==(e=tE(this,m))?void 0:e.init(tE(this,h))})}match(e,t=7){return tz(this,null,function*(){var n;let i=yield null==(n=tE(this,m))?void 0:n.search({keyword:e,limit:t}),r=tZ(e),a=(null==i?void 0:i.find(e=>tN(this,P,S).call(this,e.index)))||{index:tU,renderType:"default",hits:[]};return[{group:tE(this,p),renderType:"default",result:tN(this,f,g).call(this,r,a)},...((null==i?void 0:i.filter(e=>!tN(this,P,S).call(this,e.index)))||[]).map(e=>({group:e.index,renderType:"default",result:tN(this,f,g).call(this,r,e)}))]})}};function t7(){var e;let{siteData:t,page:n}=(0,_.Vi)(),[i,r]=(0,T.useState)(!1),{sidebar:a}=tT(),o=e=>tO(a,e).group,l=(0,T.useRef)(null);return(0,T.useEffect)(()=>{!function(){tz(this,null,function*(){if(!i){let e=new t6(tI(tj({},t.search),{mode:"local",currentLang:n.lang,currentVersion:n.version,extractGroupName:o}));l.current=e,yield e.init(),r(!0)}})}()},[]),{initialized:i,search:null==(e=l.current)?void 0:e.match.bind(l.current)}}function t8(){let{siteData:e,page:t}=(0,_.Vi)(),n=e.lang||"",i=Object.values(e.themeConfig.locales||{}).map(e=>e.lang)||[],r=t.lang;(0,T.useEffect)(()=>{var t;let a;if("auto"!==(null!=(t=e.themeConfig.localeRedirect)?t:"auto")||!n)return;let{pathname:o,search:l}=window.location,s=(0,N.E9)(o),d="rspress-visited";if(localStorage.getItem(d))return;localStorage.setItem(d,"1");let c=window.navigator.language.split("-")[0];if(!!i.includes(c)&&c!==r)(a=c===n?o.replace(`/${r}`,""):r===n?(0,N.pJ)(`/${c}${s}`):o.replace(`/${r}`,`/${c}`))&&window.location.replace(a+l)},[])}h=new WeakMap,p=new WeakMap,m=new WeakMap,f=new WeakSet,g=function(e,t){let n=[];return null==t||t.hits.forEach(t=>{if(tN(this,x,v).call(this,t,e,n),!tN(this,b,y).call(this,t,e,n))tN(this,w,k).call(this,t,e,n)}),n},x=new WeakSet,v=function(e,t,n){let{title:i=""}=e,r=tZ(i);return!!r.includes(t)&&(n.push({type:"title",title:i,header:i,link:`${e.domain}${(0,N.AP)(e.routePath)}`,query:t,highlightInfoList:[{start:r.indexOf(t),length:tX(t)}],group:tE(this,h).extractGroupName(e.routePath)}),!0)},b=new WeakSet,y=function(e,t,n){let{toc:i=[],domain:r="",title:a=""}=e;for(let[o,l]of i.entries())if(tZ(l.text).includes(t)){let s=(function(e,t){let n=e[t],i=t,r=[n];for(;n&&n.depth>2;){let t=!1;for(let a=i-1;a>=0;a--){let o=e[a];if(o.depth>1&&o.depth===n.depth-1){n=o,i=a,r.unshift(n),t=!0;break}}if(!t)break}return r})(i,o).map(e=>e.text).join(" > "),d=tZ(s).indexOf(t),c=`${a} > `;return n.push({type:"header",title:e.title,header:`${c}${s}`,highlightInfoList:[{start:d+c.length,length:tX(t)}],link:`${r}${(0,N.AP)(e.routePath)}#${l.id}`,query:t,group:tE(this,h).extractGroupName(e.routePath)}),!0}return!1},w=new WeakSet,k=function(e,t,n){var i,r,a;let{content:o,toc:l,domain:s}=e;if(!o.length)return;let d=tZ(o),c=d.indexOf(t),u=l.map(e=>e.charIndex),p=e=>l[u.findIndex((t,n)=>{if(!(n=e)return!0}return!1})];if(-1===c){let a=null==(i=e._matchesPosition)?void 0:i.content;if(!(null==a?void 0:a.length))return;let l=e._matchesPosition.content[0].start,d=p(l),c=tQ(o,l),u=tQ(o,l+100),m=o.slice(c,u),f=e._matchesPosition.content.filter(e=>e.start>=l&&e.start+e.length<=l+100).map(e=>({start:tQ(o,e.start)-c+3,length:e.length}));n.push({type:"content",title:e.title,header:null!=(r=null==d?void 0:d.text)?r:e.title,link:`${s}${(0,N.AP)(e.routePath)}${d?`#${d.id}`:""}`,query:t,highlightInfoList:f,group:tE(this,h).extractGroupName(e.routePath),statement:`...${m}...`});return}for(;-1!==c;){let i=p(c),r=o.slice(0,c).lastIndexOf("\n");r=-1===r?0:r;let l=o.indexOf("\n\n",c+t.length),u=o.slice(r,l);u.length>100&&(u=tN(this,j,I).call(this,u,t));let m=tZ(u).indexOf(t),f=[{start:m,length:tX(t)}];n.push({type:"content",title:e.title,header:null!=(a=null==i?void 0:i.text)?a:e.title,statement:u,highlightInfoList:f,link:`${s}${(0,N.AP)(e.routePath)}${i?`#${i.id}`:""}`,query:t,group:tE(this,h).extractGroupName(e.routePath)}),c=d.indexOf(t,c+u.length-m)}},j=new WeakSet,I=function(e,t){let n=tZ(e).indexOf(tZ(t)),i=Math.floor((100-t.length)/2),r=e.slice(0,n);r.length>i&&(r=`...${e.slice(n-i+3,n)}`);let a=e.slice(n+t.length);return a.length>i&&(a=`${e.slice(n+t.length,n+i-3)}...`),r+t+a},P=new WeakSet,S=function(e){return e===tE(this,p)||e===tU};var t9=e=>{let t=(0,T.useRef)(e);return t.current=e,(0,T.useRef)((...e)=>t.current(...e)).current},ne=e=>{let[t,n]=(0,T.useState)(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return(0,T.useEffect)(()=>{let t=window.matchMedia(e),i=e=>n(e.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[e]),t},nt=(e,t=null)=>{let[n,i]=(0,T.useState)(()=>{var n;return"undefined"==typeof window?t:null!=(n=localStorage.getItem(e))?n:t}),r=(0,T.useCallback)(t=>{i(n=>{let i="function"==typeof t?t(n):t;return null==i?localStorage.removeItem(e):localStorage.setItem(e,i),i})},[e]);return(0,T.useEffect)(()=>{let n=n=>{var r;n.key===e&&i(null!=(r=localStorage.getItem(e))?r:t)};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}},[e,t]),[n,r]},nn=e=>["light","dark","auto"].includes(e)?e:"auto",ni=!1===L.Z.themeConfig.darkMode,nr=()=>{let e=ne("(prefers-color-scheme: dark)"),[t,n]=nt(F.rp),i=t9(()=>{if(ni)return"light";let n=nn(t);return"auto"===n?e?"dark":"light":n}),[r,a]=(0,T.useState)(()=>{var e;if("undefined"==typeof window)return"light";let t=null!=(e=window.RSPRESS_THEME)?e:window.MODERN_THEME;return t?"dark"===t?"dark":"light":i()}),o=(0,T.useCallback)((e,t=e)=>{if(!ni)a(e),n(t),s(!0)},[]);(0,T.useEffect)(()=>{document.documentElement.classList.toggle("dark","dark"===r),document.documentElement.style.colorScheme=r},[r]);let[l,s]=(0,T.useState)(!0);return(0,T.useEffect)(()=>{s(!1)},[l]),(0,T.useEffect)(()=>{if(!l)o(i(),nn(t))},[t]),(0,T.useEffect)(()=>{if(!l)o(e?"dark":"light","auto")},[e]),[r,o]};function na(e,t,n=!1){return!!t&&(n?(0,N.pV)(e,t):(0,N.pV)(e,t)||e.startsWith(t))}function no(){return window.innerWidth<=1024}function nl(e){var t;if(!e)return"";if((0,K.Z)(e))return e;return(t=(t=e).trim().slice(0,1e3),Z.test(t)||Y.test(t))?V(e):e}var ns=/`(.*?)`/g,nd=RegExp("\\*{2}(?!\\*)(.*?)(?$1").replace(nc,"$1").replace(ns,"$1"))}function nh(e){return e.replace(nd,"$1").replace(nc,"$1").replace(ns,"$1")}function np(e){var t;let{headers:n}=e,i=n.length>0,r=(null==(t=n[0])?void 0:t.depth)||2,a=tB();return(0,T.useEffect)(()=>{let e;setTimeout(()=>{e=tF()},100);let t=decodeURIComponent(window.location.hash);if(t){let e=document.getElementById(t.slice(1));e&&tH(e,!1,a?0:72)}else window.scrollTo(0,0);return()=>{e&&e()}},[n]),(0,z.jsx)("div",{className:"flex flex-col",children:(0,z.jsx)("div",{className:i?"(0,z.jsx)("li",{children:(0,z.jsx)("a",{href:`#${e.id}`,title:nh(e.text),className:"aside-link transition-all duration-300 hover:text-text-1 text-text-2 block",style:{paddingLeft:(e.depth-r)*12,fontWeight:"semibold"},onClick:t=>{t.preventDefault(),window.location.hash=e.id;let n=document.getElementById(e.id);n&&tH(n,!1,a?0:72)},children:(0,z.jsx)("span",{className:"aside-link-text block",children:nu(e.text)})})},e.id))})})]})})})}var nm="prev_e7091",nf="next_e7091";function ng(){let{prevPage:e,nextPage:t}=tL(),{lastUpdated:n=!1}=tT(),{siteData:i}=(0,_.Vi)(),{themeConfig:r}=i,a=r.lastUpdated||n;return(0,z.jsxs)("footer",{className:"mt-8",children:[(0,z.jsx)("div",{className:"xs:flex pb-5 px-2 justify-end items-center",children:a&&(0,z.jsx)(io,{})}),(0,z.jsx)("div",{className:"flex flex-col",children:(0,z.jsx)(n5,{})}),(0,z.jsxs)("div",{className:"flex flex-col sm:flex-row sm:justify-around gap-4 pt-6",children:[(0,z.jsx)("div",{className:`${nm} flex flex-col`,children:e?(0,z.jsx)(iU,{type:"prev",text:e.text,href:(0,N.AP)(e.link)}):null}),(0,z.jsx)("div",{className:`${nf} flex flex-col`,children:t?(0,z.jsx)(iU,{type:"next",text:t.text,href:(0,N.AP)(t.link)}):null})]})]})}function nx(e){var{icon:t}=e,n=tP(e,["icon"]);return t?"string"==typeof t?(0,z.jsx)("img",tj({src:t,alt:""},n)):(0,z.jsx)(t,tj({},n)):null}function nv({outlineTitle:e,beforeSidebar:t,afterSidebar:n,uiSwitch:i}){let[r,a]=(0,T.useState)(!1),[o,l]=(0,T.useState)(!1),s=(0,T.useRef)(),d=(0,T.useRef)(),{pathname:c}=(0,O.TH)();(0,T.useEffect)(()=>{a(!1)},[c]),(0,T.useEffect)(()=>(document.addEventListener("mouseup",u),document.addEventListener("touchend",u),()=>{document.addEventListener("mouseup",u),document.removeEventListener("touchend",u)}),[]);let u=e=>{let{current:t}=d;if(null==t?void 0:t.contains(e.target))return;let{current:n}=s;n&&!n.contains(e.target)&&l(!1)};return(0,z.jsxs)(T.Fragment,{children:[(0,z.jsxs)("div",{className:"rspress-sidebar-menu",children:[i.showSidebar?(0,z.jsxs)("button",{onClick:function(){a(!0)},className:"flex-center mr-auto",children:[(0,z.jsx)("div",{className:"text-md mr-2",children:(0,z.jsx)(nx,{icon:J})}),(0,z.jsx)("span",{className:"text-sm",children:"Menu"})]}):null,i.showAside?(0,z.jsxs)(T.Fragment,{children:[(0,z.jsxs)("button",{onClick:()=>l(e=>!e),className:"flex-center ml-auto",ref:d,children:[(0,z.jsx)("span",{className:"text-sm",children:e}),(0,z.jsx)("div",{className:"text-md mr-2",style:{transform:o?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease-out",marginTop:"2px"},children:(0,z.jsx)(nx,{icon:Q})})]}),(0,z.jsx)(eg,{in:o,timeout:300,unmountOnExit:!0,classNames:"fly-in",nodeRef:s,children:(0,z.jsx)("div",{className:"rspress-local-toc-container",ref:s,children:(0,z.jsx)(rp,{onItemClick:()=>{l(!1)}})})})]}):null]}),i.showSidebar?(0,z.jsxs)(T.Fragment,{children:[(0,z.jsx)(ro,{isSidebarOpen:r,beforeSidebar:t,afterSidebar:n,uiSwitch:i}),r?(0,z.jsx)("div",{onClick:function(){a(!1)},className:"rspress-sidebar-back-drop",style:{background:"rgba(0, 0, 0, 0.6)"}}):null]}):null]})}var nb=(0,T.createContext)({tabData:{},setTabData:()=>{}}),ny={asideContainer:"aside-container_edeb4",docLayout:"docLayout_edeb4",content:"content_edeb4"};function nw(e){var t,n;let{beforeDocFooter:i,afterDocFooter:r,beforeDoc:a,afterDoc:o,beforeDocContent:l,afterDocContent:s,beforeOutline:d,afterOutline:c,beforeSidebar:u,afterSidebar:h,uiSwitch:p}=e,{siteData:m,page:f}=(0,_.Vi)(),{toc:g=[],frontmatter:x}=f,[v,b]=(0,T.useState)({}),{themeConfig:y}=m,w=null!=(t=y.enableScrollToTop)&&t,k=tT(),j=(null==k?void 0:k.outlineTitle)||(null==y?void 0:y.outlineTitle)||"ON THIS PAGE",I=null!=(n=null==x?void 0:x.overview)&&n,P=(0,z.jsx)(nb.Provider,{value:{tabData:v,setTabData:b},children:(0,z.jsx)(D.Zo,{components:nX(),children:(0,z.jsx)(B,{})})});return(0,z.jsxs)("div",{className:`${ny.docLayout} pt-0`,style:tj({},p.showNavbar?{}:{marginTop:0}),children:[a,(0,z.jsx)(nv,{outlineTitle:j,beforeSidebar:u,afterSidebar:h,uiSwitch:p}),(0,z.jsxs)("div",{className:`${ny.content} rspress-doc-container flex flex-shrink-0 mx-auto`,children:[(0,z.jsx)("div",{className:"w-full flex-1",children:I?(0,z.jsxs)(z.Fragment,{children:[l,(0,z.jsx)(iR,{content:P}),s]}):(0,z.jsxs)("div",{children:[(0,z.jsxs)("div",{className:"rspress-doc",children:[l,P,s]}),(0,z.jsxs)("div",{className:"rspress-doc-footer",children:[i,p.showDocFooter&&(0,z.jsx)(ng,{}),r]})]})}),w&&(0,z.jsx)(H,{children:(0,z.jsx)(iG,{})}),p.showAside?(0,z.jsx)("div",{className:ny.asideContainer,style:tj({},p.showNavbar?{}:{marginTop:0,paddingTop:"32px"}),children:(0,z.jsxs)("div",{children:[d,(0,z.jsx)(np,{headers:g,outlineTitle:j}),c]})}):null]}),o]})}var nk=(e,t)=>t?(e=e.trim(),(t=t.trim()).startsWith("-")||t.startsWith("|"))?`${e} ${t}`:`${e} - ${t}`:e,nj=e=>{var t;let{top:n,bottom:i,beforeDocFooter:r,afterDocFooter:a,beforeDoc:o,afterDoc:l,beforeDocContent:s,afterDocContent:d,beforeSidebar:c,afterSidebar:u,beforeOutline:h,afterOutline:p,beforeNavTitle:m,afterNavTitle:f,beforeNav:g,beforeHero:x,afterHero:v,beforeFeatures:b,afterFeatures:y,afterNavMenu:w}=e,k={beforeDocFooter:r,afterDocFooter:a,beforeDocContent:s,afterDocContent:d,beforeDoc:o,afterDoc:l,beforeSidebar:c,afterSidebar:u,beforeOutline:h,afterOutline:p},j={beforeHero:x,afterHero:v,beforeFeatures:b,afterFeatures:y},{siteData:I,page:P}=(0,_.Vi)(),{pageType:S,lang:E,title:C,frontmatter:N={}}=P,M=tT();t8();let L=null!=(t=N.title)?t:C,R=I.title||M.title;L=L&&"doc"===S?nk(L,N.titleSuffix||R):"home"===S?nk(R,N.titleSuffix):"404"===S?nk("404",R):R;let $=(null==N?void 0:N.description)||I.description||M.description,D=function(){var e,t;let{page:n,siteData:i}=(0,_.Vi)(),{frontmatter:r}=n,{themeConfig:a}=i,o=tT(),l=(0,O.TH)(),s=null!=(e=null==r?void 0:r.overview)&&e,d=()=>{var e,t;let n="undefined"==typeof window||window.top===window.self;return(null!=(t=null!=(e=null==r?void 0:r.outline)?e:null==a?void 0:a.outline)?t:n)&&!s},[c,u]=t$(),[h,p]=(0,T.useState)(d()),[m,f]=(0,T.useState)(null==(t=null==r?void 0:r.footer)||t),g=o.sidebar||{},x=(null==r?void 0:r.sidebar)!==!1&&Object.keys(g).length>0;return(0,T.useEffect)(()=>{p(d())},[n,i]),(0,T.useEffect)(()=>{let e=new URLSearchParams(l.search),t=document.documentElement.style,n=t.getPropertyValue("--rp-sidebar-width"),i=t.getPropertyValue("--rp-aside-width"),r=e.get("navbar"),a=e.get("sidebar"),o=e.get("outline"),s=e.get("footer");return"0"===r&&u(!1),"0"===a&&document.documentElement.style.setProperty("--rp-sidebar-width","0px"),"0"===o&&document.documentElement.style.setProperty("--rp-aside-width","0px"),"0"===s&&f(!1),()=>{document.documentElement.style.setProperty("--rp-sidebar-width",n),document.documentElement.style.setProperty("--rp-aside-width",i),u(c),f(m)}},[l.search]),(0,T.useEffect)(()=>{F._f&&history.scrollRestoration&&(history.scrollRestoration=l.hash.length?"manual":"auto")},[!l.hash.length]),{showAside:h,showNavbar:c,showSidebar:x,showDocFooter:m}}();return(0,z.jsxs)("div",{children:[(0,z.jsxs)(A.ql,{htmlAttributes:{lang:E||"en"},children:[L?(0,z.jsx)("title",{children:L}):null,$?(0,z.jsx)("meta",{name:"description",content:$}):null]}),n,"blank"!==S&&D.showNavbar&&(0,z.jsx)(iM,{beforeNavTitle:m,afterNavTitle:f,beforeNav:g,afterNavMenu:w}),(0,z.jsx)("section",{children:(()=>{switch(S){case"home":return(0,z.jsx)(rm.HomeLayout,tj({},j));case"doc":return(0,z.jsx)(nw,tI(tj({},k),{uiSwitch:D}));case"404":return(0,z.jsx)(rm.NotFoundLayout,{});case"custom":case"blank":return(0,z.jsx)(B,{});default:return(0,z.jsx)(nw,tj({},k))}})()}),i]})};function nI(e){let{beforeHero:t,afterHero:n,beforeFeatures:i,afterFeatures:r}=e,{page:{frontmatter:a,routePath:o}}=(0,_.Vi)();return(0,z.jsxs)("div",{className:"relative",style:{minHeight:"calc(100vh - var(--rp-nav-height))",paddingBottom:"80px"},children:[(0,z.jsxs)("div",{className:"pb-12",children:[t,(0,z.jsx)(ir,{frontmatter:a,routePath:o}),n,i,(0,z.jsx)(n8,{frontmatter:a}),r]}),(0,z.jsx)(n9,{})]})}var nP={title:"title_3b154",blockquote:"blockquote_3b154",link:"link_3b154","inline-link":"inline-link_3b154"},nS=e=>(0,z.jsx)("h1",tI(tj({},e),{className:`text-3xl mb-10 leading-10 tracking-tight ${nP.title}`})),nE=e=>(0,z.jsx)("h2",tI(tj({},e),{className:`mt-12 mb-6 pt-8 text-2xl tracking-tight border-t-[1px] border-divider-light ${nP.title}`})),nC=e=>(0,z.jsx)("h3",tI(tj({},e),{className:`mt-10 mb-2 leading-7 text-xl ${nP.title}`})),n_=e=>(0,z.jsx)("h4",tI(tj({},e),{className:`mt-8 leading-6 text-lg ${nP.title}`})),nN=e=>(0,z.jsx)("h5",tI(tj({},e),{className:nP.title})),nz=e=>(0,z.jsx)("h6",tI(tj({},e),{className:nP.title})),nA=e=>(0,z.jsx)("ol",tI(tj({},e),{className:"list-decimal pl-5 my-4 leading-7"})),nT=e=>(0,z.jsx)("ul",tI(tj({},e),{className:"list-disc pl-5 my-4 leading-7"})),nO=e=>(0,z.jsx)("li",tI(tj({},e),{className:"[&:not(:first-child)]:mt-2"})),nM=e=>(0,z.jsx)("table",tI(tj({},e),{className:"block border-collapse text-base my-5 overflow-x-auto leading-7 border-gray-light-3 dark:border-divider"})),nL=e=>(0,z.jsx)("tr",tI(tj({},e),{className:"border border-solid transition-colors duration-500 even:bg-soft border-gray-light-3 dark:border-divider"})),nR=e=>(0,z.jsx)("td",tI(tj({},e),{className:"border border-solid px-4 py-2 border-gray-light-3 dark:border-divider"})),n$=e=>(0,z.jsx)("th",tI(tj({},e),{className:"border border-solid px-4 py-2 text-text-1 text-base font-semibold border-gray-light-3 dark:border-divider"})),nB=e=>(0,z.jsx)("hr",tI(tj({},e),{className:"my-12 border-t border-solid border-divider-light"})),nD=e=>{let{href:t="",className:n=""}=e,{normalizeLinkHref:i}=tq();return n.includes("header-anchor")||t.startsWith("#")?(0,z.jsx)("a",tI(tj({},e),{className:`${nP.link} ${n}`})):(0,z.jsx)(is,tI(tj({},e),{className:`${n} ${nP.link} ${nP["inline-link"]}`,href:i(t)}))},nH=e=>(0,z.jsx)("p",tI(tj({},e),{className:"my-4 leading-7"})),nF=e=>(0,z.jsx)("blockquote",tI(tj({},e),{className:`border-l-2 border-solid border-divider pl-4 my-6 transition-colors duration-500 ${nP.blockquote}`})),nW=e=>(0,z.jsx)("strong",tI(tj({},e),{className:"font-semibold"})),nq={"code-button-group":"code-button-group_15153",codeButtonGroup:"code-button-group_15153","code-copy-button":"code-copy-button_15153",codeCopyButton:"code-copy-button_15153","icon-success":"icon-success_15153",iconSuccess:"icon-success_15153","code-copied":"code-copied_15153",codeCopied:"code-copied_15153","icon-copy":"icon-copy_15153",iconCopy:"icon-copy_15153","icon-wrapped":"icon-wrapped_15153",iconWrapped:"icon-wrapped_15153","wrapped-btn":"wrapped-btn_15153",wrappedBtn:"wrapped-btn_15153","icon-wrap":"icon-wrap_15153",iconWrap:"icon-wrap_15153"},nU={doctype:{color:"var(--code-token-text)",fontStyle:"italic"},token:{color:"var(--code-token-text)"},comment:{color:"var(--code-token-comment)"},punctuation:{color:"var(--code-token-punctuation)"},property:{color:"var(--code-token-parameter)"},constant:{color:"var(--code-token-constant)"},string:{color:"var(--code-token-string)"},symbol:{color:"var(--code-token-symbol)"},variable:{color:"var(--code-token-variable)"},"attr-name":{color:"var(--code-token-symbol)"},"attr-value":{color:"var(--code-token-string-expression)"},builtin:{color:"var(--code-token-symbol)"},function:{color:"var(--code-token-function)"},keyword:{color:"var(--code-token-keyword)"},tag:{color:"var(--code-token-function)"},inserted:{color:"var(--code-token-inserted)"},deleted:{color:"var(--code-token-deleted)"},regex:{color:"var(--code-token-keyword)"},key:{color:"var(--code-token-variable)"},title:{color:"var(--code-token-keyword)"},important:{color:"#EBCB8B",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},table:{display:"content"}},nV=!1;function nG(e){var t;let{siteData:n}=(0,_.Vi)(),{meta:i,language:r,codeWrap:a}=e,{showLineNumbers:o}=n.markdown,l="",s=[];return i&&(l=(null==(t=/{[\d,-]*}/i.exec(i))?void 0:t[0])||"")&&(s=l.replace(/[{}]/g,"").split(",").map(e=>{let[t,n]=e.split("-");return n?Array.from({length:Number(n)-Number(t)+1},(e,n)=>n+Number(t)):Number(t)}).flat()),!nV&&(Object.keys(ey).forEach(e=>{eH.registerLanguage(e,ey[e])}),eH.alias(eb),nV=!0),(0,z.jsx)(eH,{language:r,style:nU,wrapLines:!0,className:"code",wrapLongLines:a,customStyle:{backgroundColor:"inherit"},showLineNumbers:o||s.length>0,lineProps:e=>({style:tI(tj({},s.includes(e)?{backgroundColor:"var(--rp-code-line-highlight-color)"}:{}),{display:"block",padding:"0 1.25rem"})}),children:String(e.children).trim()})}var nZ=new Map;function nY({codeBlockRef:e}){let t=(0,T.useRef)(null);return(0,z.jsxs)("button",{className:nq.codeCopyButton,onClick:()=>(function(e,t){let n="",i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),r=i.nextNode();for(;r;)!r.parentElement.classList.contains("linenumber")&&(n+=r.nodeValue),r=i.nextNode();if(eF(n)&&t){t.classList.add(nq.codeCopied),clearTimeout(nZ.get(t));let e=setTimeout(()=>{t.classList.remove(nq.codeCopied),t.blur(),nZ.delete(t)},2e3);nZ.set(t,e)}})(e.current,t.current),ref:t,title:"Copy code",children:[(0,z.jsx)(nx,{icon:eW,className:nq.iconCopy}),(0,z.jsx)(nx,{icon:eq,className:nq.iconSuccess})]})}function nK(e){var t;let{siteData:n}=(0,_.Vi)(),i=null!=(t=e.codeHighlighter)?t:n.markdown.codeHighlighter,{defaultWrapCode:r}=n.markdown,[a,o]=(0,T.useState)(r),l=(0,T.useRef)(null),s=(0,T.useRef)(),{className:d}=e,c=null==d?void 0:d.replace(/language-/,"");if(!c)return(0,z.jsx)("code",tj({},e));let u=e=>{a?null==e||e.classList.remove(nq.wrappedBtn):null==e||e.classList.add(nq.wrappedBtn),o(!a)};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{ref:s,children:(()=>{if("prism"===i)return(0,z.jsx)(nG,tI(tj({},e),{language:c,codeWrap:a}));return(0,z.jsx)("code",tj({},e))})()}),(0,z.jsxs)("div",{className:nq.codeButtonGroup,children:[(0,z.jsxs)("button",{ref:l,className:nq.codeWrapButton,onClick:()=>u(l.current),title:"Toggle code wrap",children:[(0,z.jsx)(nx,{icon:ev,className:nq.iconWrapped}),(0,z.jsx)(nx,{icon:ex,className:nq.iconWrap})]}),(0,z.jsx)(nY,{codeBlockRef:s})]})]})}function nJ({children:e}){let t=e=>{let{className:t,meta:n}=e.props,i=function(e){var t,n;if(!e)return"";let i=e,r=/{[\d,-]*}/i;return(null==(t=r.exec(e))?void 0:t[0])&&(i=e.replace(r,"").trim()),null==(i=null!=(n=i.split("=")[1])?n:"")?void 0:i.replace(/["'`]/g,"")}(n);return(0,z.jsxs)("div",{className:t||"language-bash",children:[i&&(0,z.jsx)("div",{className:"rspress-code-title",children:i}),(0,z.jsx)("div",{className:"rspress-code-content rspress-scrollbar",children:e})]})};return Array.isArray(e)?(0,z.jsx)("div",{children:e.map(e=>t(e))}):t(e)}var nQ=e=>(0,z.jsx)("img",tI(tj({},e),{src:(0,N.i6)(e.src||"")}));function nX(){return{h1:nS,h2:nE,h3:nC,h4:n_,h5:nN,h6:nz,ul:nT,ol:nA,li:nO,table:nM,td:nR,th:n$,tr:nL,hr:nB,p:nH,blockquote:nF,strong:nW,a:nD,code:nK,pre:nJ,img:nQ}}var n0={badge:"badge_99dcf",info:"info_99dcf",warning:"warning_99dcf",danger:"danger_99dcf"};function n1(e){let{text:t,type:n="info"}=e;return(0,z.jsx)("span",{className:`inline-block rounded-full border border-solid border-transparent font-medium ${n0.badge} ${n0[n]}`,children:t})}var n2={button:"button_72e53",medium:"medium_72e53",big:"big_72e53",brand:"brand_72e53",alt:"alt_72e53"};function n3(e){let{theme:t="brand",size:n="big",href:i="/",external:r=!1,className:a=""}=e,o=null;return"button"===e.type?o="button":"a"===e.type&&(o=r?"a":is),T.createElement(null!=o?o:"a",{className:`${n2.button} ${n2[t]} ${n2[n]} ${a}`,href:i},e.text)}var n4="editLink_2a169";function n5(){let e=tR();if(!e)return null;let{text:t,link:n}=e;return(0,z.jsx)("a",{href:n,target:"_blank",className:n4,children:t})}var n6={"grid-2":"grid-2_d48e3",grid2:"grid-2_d48e3","grid-4":"grid-4_d48e3",grid4:"grid-4_d48e3","grid-6":"grid-6_d48e3",grid6:"grid-6_d48e3","grid-3":"grid-3_d48e3",grid3:"grid-3_d48e3",featureCard:"featureCard_d48e3"},n7=e=>{let{span:t}=e;return`grid-${t||4}`};function n8({frontmatter:e}){let t=null==e?void 0:e.features;return(0,z.jsx)("div",{className:"overflow-hidden m-auto flex flex-wrap max-w-6xl",children:null==t?void 0:t.map(e=>{let{icon:t,title:n,details:i,link:r}=e;return(0,z.jsx)("div",{className:`${n6[n7(e)]} rounded hover:var(--rp-c-brand)`,children:(0,z.jsx)("div",{className:"h-full p-2",children:(0,z.jsxs)("article",{className:`rspress-home-feature-card ${n6.featureCard} h-full p-8 rounded-4xl border-transparent`,style:{cursor:r?"pointer":"auto"},onClick:()=>{r&&(window.location.href=r)},children:[t?(0,z.jsx)("div",{className:"flex-center",children:(0,z.jsx)("div",{className:"rspress-home-feature-icon w-12 h-12 text-3xl text-center",children:t})}):null,(0,z.jsx)("h2",{className:"rspress-home-feature-title font-bold text-center",children:n}),(0,z.jsx)("p",{className:"rspress-home-feature-detail leading-6 pt-2 text-sm text-text-2 font-medium",children:nl(i)})]},n)})},n)})})}function n9(){let{siteData:e}=(0,_.Vi)(),{message:t}=e.themeConfig.footer||{};return(0,z.jsx)("footer",{className:"absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light",children:(0,z.jsx)("div",{className:"m-auto w-full text-center",children:t&&(0,z.jsx)("div",{className:"font-meduim text-sm text-text-2",dangerouslySetInnerHTML:{__html:t}})})})}var ie="clip_c867a",it="mask_c867a",ii={name:"modern",text:"modern ssg",tagline:"modern ssg",actions:[],image:void 0};function ir({frontmatter:e,routePath:t}){var n,i,r,a,o,l,s,d,c;let u=(null==e?void 0:e.hero)||ii,h=void 0!==u.image,p=h?"sm:max-w-xl":"sm:max-w-4xl",m=u.text?u.text.toString().split(/\n/g).filter(e=>""!==e):[],f="string"==typeof(null==(n=u.image)?void 0:n.src)?{light:u.image.src,dark:u.image.src}:(null==(i=u.image)?void 0:i.src)||{light:"",dark:""};return(0,z.jsxs)("div",{className:"m-auto pt-0 px-6 pb-12 sm:pt-10 sm:px-16 md:pt-16 md:px-16 md:pb-16 relative",children:[(0,z.jsx)("div",{className:it,style:{left:h?"75%":"50%"}}),(0,z.jsxs)("div",{className:"m-auto flex flex-col md:flex-row max-w-6xl min-h-[50vh] mt-12 sm:mt-0",children:[(0,z.jsxs)("div",{className:"flex flex-col justify-center items-center text-center max-w-xl sm:max-w-4xl m-auto order-2 md:order-1",children:[(0,z.jsx)("h1",{className:"font-bold text-3xl pb-2 sm:text-6xl md:text-7xl m-auto sm:m-4 md:m-0 md:pb-3 lg:pb-2 leading-tight z-10",children:(0,z.jsx)("span",{className:ie,style:{lineHeight:"1.3"},children:nl(u.name)})}),0!==m.length&&m.map(e=>(0,z.jsx)("p",{className:`rspress-home-hero-text mx-auto md:m-0 text-3xl sm:text-5xl md:text-6xl sm:pb-2 font-bold z-10 ${p}`,style:{lineHeight:"1.2"},children:nl(e)},e)),(0,z.jsx)("p",{className:`rspress-home-hero-tagline whitespace-pre-wrap pt-4 m-auto md:m-0 text-sm sm:tex-xl md:text-[1.5rem] text-text-2 font-medium z-10 ${p}`,children:nl(u.tagline)}),(null==(r=u.actions)?void 0:r.length)&&(0,z.jsx)("div",{className:"grid md:flex md:flex-wrap md:justify-center gap-3 m--1.5 pt-6 sm:pt-8 z-10",children:u.actions.map(e=>(0,z.jsx)("div",{className:"flex flex-shrink-0 p-1",children:(0,z.jsx)(n3,{type:"a",text:nl(e.text),href:(0,N.AP)((0,F.pJ)(e.link,t)),theme:e.theme,className:"w-full"})},e.link))})]}),h?(0,z.jsxs)("div",{className:"rspress-home-hero-image md:flex-center m-auto order-1 md:order-2 sm:flex md:none lg:flex",children:[(0,z.jsx)("img",{src:(0,N.i6)(f.light),alt:null==(a=u.image)?void 0:a.alt,srcSet:ia(null==(o=u.image)?void 0:o.srcset),sizes:ia(null==(l=u.image)?void 0:l.sizes),width:375,height:375,className:"dark:hidden"}),(0,z.jsx)("img",{src:(0,N.i6)(f.dark),alt:null==(s=u.image)?void 0:s.alt,srcSet:ia(null==(d=u.image)?void 0:d.srcset),sizes:ia(null==(c=u.image)?void 0:c.sizes),width:375,height:375,className:"hidden dark:block"})]}):null]})]})}function ia(e){return(Array.isArray(e)?e:[e]).filter(Boolean).join(", ")||void 0}function io(){let{lastUpdatedText:e="Last Updated"}=tT(),{page:{lastUpdatedTime:t},siteData:n}=(0,_.Vi)(),{themeConfig:i}=n,r=(null==i?void 0:i.lastUpdatedText)||e;return(0,z.jsx)("div",{className:"flex text-sm text-text-2 leading-6 sm:leading-8 font-medium",children:(0,z.jsxs)("p",{children:[r,": ",(0,z.jsx)("span",{children:t})]})})}var il={link:"link_03735"};function is(e){let{href:t="/",children:n,className:i="",onNavigate:r,keepCurrentParams:a=!1}=e,o=tP(e,["href","children","className","onNavigate","keepCurrentParams"]),l=(0,F.xf)(t),s=l?"_blank":"",d=l?"noopener noreferrer":void 0,c=l?t:(0,N.pJ)((0,N.AP)(t)),u=(0,O.s0)(),{pathname:h,search:p}=(0,O.TH)(),m=a?c+p:c,f=(0,N.pV)(h,c);return l?(0,z.jsx)("a",tI(tj({},o),{href:c,target:s,rel:d,className:`${il.link} ${i}`,children:n})):(0,z.jsx)("a",tI(tj({},o),{className:`${il.link} ${i} cursor-pointer`,rel:d,target:s,onClick:e=>tz(this,null,function*(){if(0!==e.button||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return;e.preventDefault();let t=c.split("#")[1];if(!l&&f&&t){let e=document.getElementById(t);e&&tH(e,!0);return}if(!f){let e=(0,M.fp)(eV.routes,(0,N.Tm)(c));if(null==e?void 0:e.length){let t=setTimeout(()=>{eU.start()},200);yield e[0].route.preload(),clearTimeout(t),eU.done()}null==r||r(),u(m,{replace:!1})}}),href:c,children:n}))}eU.configure({showSpinner:!1});var id={hidden:"hidden_f6cde",container:"container_f6cde",navContainer:"navContainer_f6cde",leftNav:"leftNav_f6cde",rightNav:"rightNav_f6cde",singleItem:"singleItem_f6cde",activeItem:"activeItem_f6cde",navBarTitle:"navBarTitle_f6cde",menuItem:"menu-item_f6cde",mobileNavMenu:"mobileNavMenu_f6cde"};function ic(e){let{pathname:t,base:n}=e,i=new RegExp(e.activeMatch||e.link).test((0,F.tz)(t,n));return(0,z.jsx)(is,{href:(0,N.AP)(e.link),children:(0,z.jsxs)("div",{className:`rspress-nav-menu-item ${id.singleItem} ${i?id.activeItem:""} text-sm font-medium mx-1.5 px-3 py-2 flex items-center`,children:[(0,z.jsx)(ru,{tag:e.tag}),e.text,e.rightIcon]},e.text)})}function iu({onClick:e}){let{theme:t,setTheme:n}=(0,T.useContext)(_.Ni);return(0,z.jsx)("div",{onClick:()=>{n("dark"===t?"light":"dark"),null==e||e()},className:"md:mr-2 rspress-nav-appearance",children:(0,z.jsxs)("div",{className:"p-1 border border-solid border-gray-300 text-gray-400 cursor-pointer rounded-md hover:border-gray-600 hover:text-gray-600 dark:hover:border-gray-200 dark:hover:text-gray-200 transition-all duration-300 w-7 h-7",children:[(0,z.jsx)(nx,{className:"dark:hidden",icon:tt,width:"18",height:"18",fill:"currentColor"}),(0,z.jsx)(nx,{className:"hidden dark:block",icon:tn,width:"18",height:"18",fill:"currentColor"})]})})}var ih={socialLinksIcon:"social-links-icon_93d67",menuItem:"menu-item_93d67"},ip={discord:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Discord"}),(0,z.jsx)("path",{d:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"})]}),facebook:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Facebook"}),(0,z.jsx)("path",{d:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"})]}),github:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"GitHub"}),(0,z.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),gitlab:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"GitLab"}),(0,z.jsx)("path",{fill:"currentColor",d:"m21.94 13.11l-1.05-3.22c0-.03-.01-.06-.02-.09l-2.11-6.48a.859.859 0 0 0-.8-.57c-.36 0-.68.25-.79.58l-2 6.17H8.84L6.83 3.33a.851.851 0 0 0-.79-.58c-.37 0-.69.25-.8.58L3.13 9.82v.01l-1.07 3.28c-.16.5.01 1.04.44 1.34l9.22 6.71c.17.12.39.12.56-.01l9.22-6.7c.43-.3.6-.84.44-1.34M8.15 10.45l2.57 7.91l-6.17-7.91m8.73 7.92l2.47-7.59l.1-.33h3.61l-5.59 7.16m4.1-13.67l1.81 5.56h-3.62m-1.3.95l-1.79 5.51L12 19.24l-2.86-8.79M6.03 3.94L7.84 9.5H4.23m-1.18 4.19c-.09-.07-.13-.19-.09-.29l.79-2.43l5.82 7.45m11.38-4.73l-6.51 4.73l.02-.03l5.79-7.42l.79 2.43c.04.1 0 .22-.09.29"})]}),instagram:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Instagram"}),(0,z.jsx)("path",{d:"M12 0C8.74 0 8.333.015 7.053.072 5.775.132 4.905.333 4.14.63c-.789.306-1.459.717-2.126 1.384S.935 3.35.63 4.14C.333 4.905.131 5.775.072 7.053.012 8.333 0 8.74 0 12s.015 3.667.072 4.947c.06 1.277.261 2.148.558 2.913.306.788.717 1.459 1.384 2.126.667.666 1.336 1.079 2.126 1.384.766.296 1.636.499 2.913.558C8.333 23.988 8.74 24 12 24s3.667-.015 4.947-.072c1.277-.06 2.148-.262 2.913-.558.788-.306 1.459-.718 2.126-1.384.666-.667 1.079-1.335 1.384-2.126.296-.765.499-1.636.558-2.913.06-1.28.072-1.687.072-4.947s-.015-3.667-.072-4.947c-.06-1.277-.262-2.149-.558-2.913-.306-.789-.718-1.459-1.384-2.126C21.319 1.347 20.651.935 19.86.63c-.765-.297-1.636-.499-2.913-.558C15.667.012 15.26 0 12 0zm0 2.16c3.203 0 3.585.016 4.85.071 1.17.055 1.805.249 2.227.415.562.217.96.477 1.382.896.419.42.679.819.896 1.381.164.422.36 1.057.413 2.227.057 1.266.07 1.646.07 4.85s-.015 3.585-.074 4.85c-.061 1.17-.256 1.805-.421 2.227-.224.562-.479.96-.899 1.382-.419.419-.824.679-1.38.896-.42.164-1.065.36-2.235.413-1.274.057-1.649.07-4.859.07-3.211 0-3.586-.015-4.859-.074-1.171-.061-1.816-.256-2.236-.421-.569-.224-.96-.479-1.379-.899-.421-.419-.69-.824-.9-1.38-.165-.42-.359-1.065-.42-2.235-.045-1.26-.061-1.649-.061-4.844 0-3.196.016-3.586.061-4.861.061-1.17.255-1.814.42-2.234.21-.57.479-.96.9-1.381.419-.419.81-.689 1.379-.898.42-.166 1.051-.361 2.221-.421 1.275-.045 1.65-.06 4.859-.06l.045.03zm0 3.678c-3.405 0-6.162 2.76-6.162 6.162 0 3.405 2.76 6.162 6.162 6.162 3.405 0 6.162-2.76 6.162-6.162 0-3.405-2.76-6.162-6.162-6.162zM12 16c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4-1.79 4-4 4zm7.846-10.405c0 .795-.646 1.44-1.44 1.44-.795 0-1.44-.646-1.44-1.44 0-.794.646-1.439 1.44-1.439.793-.001 1.44.645 1.44 1.439z"})]}),linkedin:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"LinkedIn"}),(0,z.jsx)("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})]}),slack:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Slack"}),(0,z.jsx)("path",{d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})]}),twitter:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Twitter"}),(0,z.jsx)("path",{d:"M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"})]}),youtube:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"YouTube"}),(0,z.jsx)("path",{d:"M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"})]}),juejin:(0,z.jsxs)("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg","data-spm-anchor-id":"a313x.7781069.0.i5",children:[(0,z.jsx)("path",{d:"M465.189 161.792c-22.967 18.14-44.325 35.109-47.397 37.742l-5.851 4.68 10.971 8.632c5.998 4.827 11.85 9.508 13.02 10.532 1.17 1.024 17.993 14.336 37.156 29.696l34.962 27.795 5.267-3.95c2.925-2.194 23.259-18.432 45.348-35.986 21.943-17.555 41.253-32.768 42.716-33.646 1.609-1.024 2.779-2.194 2.779-2.78 0-0.438-9.655-8.63-21.504-17.846-11.995-9.363-22.674-17.847-23.845-18.871-15.945-13.02-49.737-39.059-50.76-39.059-0.586 0.147-19.896 14.922-42.862 33.061z m233.325 180.37C507.465 493.275 508.928 492.105 505.417 489.911c-3.072-1.902-11.556-8.485-64.073-50.03-9.07-7.168-18.578-14.775-21.358-16.823-2.78-2.194-8.777-6.875-13.312-10.532-4.68-3.657-10.679-8.339-13.312-10.533-13.165-10.24-71.095-56.027-102.107-80.457-5.852-4.681-11.41-8.485-12.142-8.485-0.731 0-10.971 7.754-22.674 17.116-11.703 9.508-22.674 18.286-24.284 19.456-1.755 1.17-5.12 3.95-7.46 6.144-2.34 2.34-4.828 4.096-5.413 4.096-3.072 0-0.731 3.072 6.437 8.777 4.096 3.218 8.777 6.875 10.094 8.046 1.316 1.024 10.24 8.045 19.748 15.506s23.26 18.286 30.428 23.99c19.31 15.215 31.89 25.308 127.853 101.084 47.836 37.742 88.796 69.779 90.844 71.095 3.657 2.487 3.95 2.487 7.46-0.292a1041.42 1041.42 0 0 0 16.092-12.727c6.875-5.413 14.775-11.703 17.554-13.897 30.135-23.699 80.018-63.05 81.774-64.512 1.17-1.024 12.434-9.802 24.868-19.603s37.888-29.696 56.32-44.324c18.579-14.629 46.227-36.425 61.733-48.567 15.506-12.142 27.794-22.528 27.502-23.26-0.878-1.17-57.637-47.104-59.978-48.274-0.731-0.439-18.578 12.727-39.497 29.257z","data-spm-anchor-id":"a313x.7781069.0.i2"}),(0,z.jsx)("path",{d:"M57.93 489.326c-15.215 12.288-28.527 23.405-29.697 24.576-2.34 2.194-5.412-0.44 80.018 66.852 33.207 26.185 32.622 25.747 57.637 45.495 10.386 8.192 36.279 28.672 57.783 45.495 38.18 30.135 44.91 35.401 52.663 41.545 2.048 1.756 22.967 18.14 46.372 36.572 23.26 18.432 74.167 58.514 112.933 89.088 38.912 30.573 71.095 55.734 71.826 56.027 0.732 0.293 7.46-4.389 14.921-10.386 21.797-16.97 90.259-70.949 101.523-79.872 5.705-4.535 12.873-10.24 15.945-12.58 3.072-2.488 6.436-5.12 7.314-5.852 0.878-0.878 11.85-9.509 24.283-19.31 20.773-16.091 59.1-46.226 64.366-50.615 1.17-1.024 5.12-4.096 8.777-6.875 3.657-2.78 7.9-6.29 9.509-7.607 1.609-1.317 14.775-11.703 29.257-23.113 29.11-22.82 42.277-33.207 88.503-69.632 17.262-13.605 32.475-25.454 33.646-26.478 2.486-2.048 31.451-24.869 44.617-35.255 4.827-3.657 9.07-7.168 9.508-7.607 0.44-0.585 5.998-4.827 12.435-9.8 6.436-4.828 13.165-10.24 15.067-11.85l3.365-2.926-9.948-7.753c-5.412-4.388-10.24-8.192-10.679-8.63-1.17-1.317-22.381-18.433-30.135-24.284-3.95-3.072-7.314-5.998-7.606-6.73-1.317-3.071-6.73 0.147-29.258 17.994-13.458 10.532-25.746 20.187-27.355 21.504-1.61 1.463-10.533 8.338-19.749 15.652-9.216 7.168-17.115 13.459-17.554 13.898-0.439 0.438-6.583 5.412-13.897 10.971-7.168 5.559-15.214 11.703-17.7 13.75-4.974 4.097-5.413 4.39-20.334 16.239-5.56 4.388-11.264 8.777-12.435 9.8-1.17 1.025-20.333 16.092-42.422 33.354-22.09 17.408-41.546 32.768-43.155 34.084-1.609 1.463-14.482 11.557-28.525 22.528s-40.814 32.037-59.539 46.812c-18.578 14.775-42.276 33.353-52.516 41.399s-23.26 18.285-28.965 22.82l-10.386 8.339-4.389-3.072c-2.34-1.756-4.68-3.511-5.12-3.95-0.439-0.439-4.973-4.096-10.24-8.046-11.849-9.216-14.482-11.264-16.676-13.166-0.878-0.877-4.243-3.51-7.46-5.851-3.22-2.487-6.145-4.681-6.584-5.12-0.439-0.439-6.875-5.705-14.482-11.703-7.607-5.851-14.921-11.556-16.091-12.58-1.317-1.17-17.116-13.605-35.255-27.795-17.993-14.19-35.109-27.648-38.035-29.842-5.705-4.681-33.499-26.624-125.074-98.743-34.523-27.209-72.704-57.344-84.846-66.852-49.737-39.498-55.15-43.594-56.905-43.447-0.877 0-14.043 10.24-29.257 22.528z","data-spm-anchor-id":"a313x.7781069.0.i3"})]}),qq:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M19.913 14.529a31.977 31.977 0 0 0-.675-1.886l-.91-2.246c0-.026.012-.468.012-.696C18.34 5.86 16.507 2 12 2S5.66 5.86 5.66 9.7c0 .229.011.671.012.697l-.91 2.246a32.777 32.777 0 0 0-.675 1.886c-.86 2.737-.581 3.87-.369 3.895c.455.054 1.771-2.06 1.771-2.06c0 1.224.637 2.822 2.016 3.976c-.515.157-1.147.399-1.554.695c-.365.267-.319.54-.253.65c.289.481 4.955.307 6.303.157c1.347.15 6.014.324 6.302-.158c.066-.11.112-.382-.253-.649c-.407-.296-1.039-.538-1.555-.696c1.379-1.153 2.016-2.751 2.016-3.976c0 0 1.316 2.115 1.771 2.06c.212-.025.49-1.157-.37-3.894"})}),wechat:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M18.574 13.711a.91.91 0 0 0 .898-.898c0-.498-.399-.898-.898-.898s-.898.4-.898.898c0 .5.4.898.898.898zm-4.425 0a.91.91 0 0 0 .898-.898c0-.498-.4-.898-.898-.898c-.5 0-.898.4-.898.898c0 .5.399.898.898.898zm6.567 5.04a.347.347 0 0 0-.172.37c0 .048 0 .097.025.147c.098.417.294 1.081.294 1.106c0 .073.025.122.025.172a.22.22 0 0 1-.221.22c-.05 0-.074-.024-.123-.048l-1.449-.836a.799.799 0 0 0-.344-.098c-.073 0-.147 0-.196.024c-.688.197-1.4.295-2.161.295c-3.66 0-6.607-2.457-6.607-5.505c0-3.047 2.947-5.505 6.607-5.505c3.659 0 6.606 2.458 6.606 5.505c0 1.647-.884 3.146-2.284 4.154zM16.673 8.099a9.105 9.105 0 0 0-.28-.005c-4.174 0-7.606 2.86-7.606 6.505c0 .554.08 1.09.228 1.6h-.089a9.963 9.963 0 0 1-2.584-.368c-.074-.025-.148-.025-.222-.025a.832.832 0 0 0-.418.123l-1.748 1.005c-.05.025-.099.05-.148.05a.273.273 0 0 1-.27-.27c0-.074.024-.123.049-.197c.024-.024.246-.834.369-1.324c0-.05.024-.123.024-.172a.556.556 0 0 0-.221-.442C2.058 13.376 1 11.586 1 9.598C1 5.945 4.57 3 8.95 3c3.765 0 6.93 2.169 7.723 5.098zm-5.154.418c.573 0 1.026-.477 1.026-1.026c0-.573-.453-1.026-1.026-1.026s-1.026.453-1.026 1.026s.453 1.026 1.026 1.026zm-5.26 0c.573 0 1.027-.477 1.027-1.026c0-.573-.454-1.026-1.027-1.026c-.572 0-1.026.453-1.026 1.026s.454 1.026 1.026 1.026z"})}),weibo:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M17.525 11.378c1.263.392 2.669 1.336 2.669 3.004c0 2.763-3.98 6.239-9.964 6.239c-4.565 0-9.23-2.213-9.23-5.852c0-1.902 1.204-4.102 3.277-6.177c2.773-2.77 6.004-4.033 7.219-2.816c.537.537.588 1.464.244 2.572c-.178.557.525.25.525.25c2.24-.938 4.196-.994 4.909.027c.38.543.343 1.306-.008 2.19c-.163.407.048.471.36.563zm-7.282 7.939c3.641-.362 6.401-2.592 6.167-4.983c-.237-2.391-3.382-4.038-7.023-3.677c-3.64.36-6.403 2.59-6.167 4.98c.237 2.394 3.382 4.039 7.023 3.68zM6.16 14.438c.754-1.527 2.712-2.39 4.446-1.94c1.793.463 2.707 2.154 1.976 3.8c-.744 1.682-2.882 2.578-4.695 1.993c-1.752-.566-2.493-2.294-1.727-3.853zm1.446 2.587c.568.257 1.325.013 1.676-.55c.346-.568.163-1.217-.407-1.459c-.563-.237-1.291.008-1.64.553c-.354.547-.189 1.202.371 1.456zm2.206-1.808c.219.092.501-.012.628-.231c.123-.22.044-.466-.178-.548c-.216-.084-.486.018-.613.232c-.123.214-.054.458.163.547zM19.873 9.5a.725.725 0 1 1-1.378-.451a1.38 1.38 0 0 0-.288-1.357a1.395 1.395 0 0 0-1.321-.425a.723.723 0 1 1-.303-1.416a2.836 2.836 0 0 1 3.29 3.649zm-3.916-6.575A5.831 5.831 0 0 1 21.5 4.72a5.836 5.836 0 0 1 1.22 5.704a.838.838 0 0 1-1.06.54a.844.844 0 0 1-.542-1.062a4.143 4.143 0 0 0-4.807-5.327a.845.845 0 0 1-.354-1.65z"})}),zhihu:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"m12.344 17.963l-1.688 1.074l-2.131-3.35c-.44 1.402-1.172 2.665-2.139 3.825c-.402.483-.82.918-1.301 1.375c-.155.147-.775.717-.878.82l-1.414-1.414c.139-.139.787-.735.915-.856c.43-.408.795-.79 1.142-1.206c1.266-1.518 2.03-3.21 2.137-5.231H3v-2h4V7h-.868c-.689 1.266-1.558 2.222-2.618 2.857L2.486 8.143c1.395-.838 2.425-2.604 3.038-5.36l1.952.434c-.14.633-.303 1.227-.489 1.783H11.5v2H9v4h2.5v2H9.185l3.159 4.963zm3.838-.07L17.298 17H19V7h-4v10h.736l.446.893zM13 5h8v14h-3l-2.5 2l-1-2H13V5z"})}),bilibili:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",className:"iconify iconify--ri",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24",width:"24",height:"24",children:(0,z.jsx)("path",{fill:"currentColor",d:"M18.223 3.086a1.25 1.25 0 0 1 0 1.768L17.08 5.996h1.17A3.75 3.75 0 0 1 22 9.747v7.5a3.75 3.75 0 0 1-3.75 3.75H5.75A3.75 3.75 0 0 1 2 17.247v-7.5a3.75 3.75 0 0 1 3.75-3.75h1.166L5.775 4.855a1.25 1.25 0 1 1 1.767-1.768l2.652 2.652c.079.079.145.165.198.257h3.213c.053-.092.12-.18.199-.258l2.651-2.652a1.25 1.25 0 0 1 1.768 0zm.027 5.42H5.75a1.25 1.25 0 0 0-1.247 1.157l-.003.094v7.5c0 .659.51 1.199 1.157 1.246l.093.004h12.5a1.25 1.25 0 0 0 1.247-1.157l.003-.093v-7.5c0-.69-.56-1.25-1.25-1.25zm-10 2.5c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25zm7.5 0c.69 0 1.25.56 1.25 1.25v1.25a1.25 1.25 0 1 1-2.5 0v-1.25c0-.69.56-1.25 1.25-1.25z"})}),lark:(0,z.jsxs)("svg",{viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"Lark"}),(0,z.jsx)("path",{d:"M8.813 5.477c1.038.836 2.286 2.045 3.3 3.495.171.23.377.576.457.71l.034.056a8.803 8.803 0 0 0-.922 1.3l-.271-.494C9.655 7.53 6.3 5.477 6.137 5.377a.447.447 0 0 1-.006-.004l-.666-.393-.107-.086a.499.499 0 0 1 .306-.885L6.084 4h7.997c.159.006.318.037.47.092.174.064.317.174.458.308.134.143.272.296.403.448.622.675 1.324 1.688 1.324 1.688-.573.193-1.349.736-1.349.736a5.095 5.095 0 0 0-.348-.54 20.665 20.665 0 0 0-1.037-1.255H8.813Z",fill:"currentColor"}),(0,z.jsx)("path",{d:"M18.482 7.507a5.42 5.42 0 0 1 4.04.717c.248.168.788.635.242 1.233-1.7 1.67-2.194 3.225-2.63 4.599-.278.873-.541 1.697-1.066 2.424-1.813 2.508-4.114 4-6.837 4.434-.561.089-1.132.131-1.7.131-3.958 0-7.498-2.035-8.75-2.844h.003l-.161-.107c-.534-.378-.61-.723-.623-.989V7.055a.486.486 0 0 1 .827-.317l.482.589c5.082 6.201 9.126 8.063 11.626 8.53 2.246.424 3.631-.165 4.022-.37.333-.51.534-1.143.764-1.865l.006-.021c.406-1.276.898-2.821 2.322-4.477a3.93 3.93 0 0 0-2.28-.168c-1.761.394-3.403 1.96-4.89 4.643a8.27 8.27 0 0 0-.341.671c-.724-.107-1.334-.65-1.334-.65.128-.269.22-.455.345-.672 1.718-3.125 3.714-4.962 5.933-5.441ZM2.477 16.889c1.145.744 5.341 3.232 9.532 2.563 1.56-.247 2.963-.915 4.196-1.99-2.771.254-7.557-.753-13.728-7.666v7.093Z",fill:"currentColor"})]}),X:(0,z.jsxs)("svg",{role:"img",viewBox:"0 0 24 24",width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg",children:[(0,z.jsx)("title",{children:"X"}),(0,z.jsx)("path",{d:"M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"})]})},im=e=>{let{link:t,popperStyle:n={}}=e,{icon:i,mode:r="link",content:a}=t,o="object"==typeof i?(0,z.jsx)("div",{dangerouslySetInnerHTML:{__html:i.svg}}):ip[i],[l,s]=(0,T.useState)(!1),d=()=>{s(!0)},c=()=>{s(!1)};return"link"===r?(0,z.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"social-links",children:(0,z.jsx)("div",{className:`${ih.socialLinksIcon}`,children:o})},a):"text"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative mx-3`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{style:tj({boxShadow:"var(--rp-shadow-3)",border:"1px solid var(--rp-c-divider-light)"},n),className:"z-[1] p-3 w-50 absolute right-0 bg-white dark:bg-dark",children:(0,z.jsx)("div",{className:"text-md",children:a})}):null]}):"img"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{className:"break-all z-[1] p-3 w-[50px] h-[50px] absolute right-0 bg-white dark:bg-dark rounded-xl",style:tj({boxShadow:"var(--rp-shadow-3)"},n),children:(0,z.jsx)("img",{src:a,alt:"img"})}):null]}):"dom"===r?(0,z.jsxs)("div",{className:`${ih.socialLinksIcon} cursor-pointer relative`,onMouseEnter:d,onMouseLeave:c,children:[o,l?(0,z.jsx)("div",{className:"break-all z-[1] p-3 absolute right-0 bg-white dark:bg-dark rounded-xl",style:tj({boxShadow:"var(--rp-shadow-3)"},n),children:(0,z.jsx)("div",{dangerouslySetInnerHTML:{__html:a}})}):null]}):(0,z.jsx)("div",{})},ig=e=>{let{links:t,moreIconVisible:n=!1,mouseEnter:i}=e;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:"flex-center h-full gap-x-4 transition-colors duration-300 md:mr-2",children:t.map((e,t)=>(0,z.jsx)(im,{link:e,popperStyle:{top:"2.5rem"}},t))}),n?(0,z.jsx)("div",{className:"md:ml-1 p-2",onMouseEnter:i,children:(0,z.jsx)(nx,{icon:ti})}):null]})},ix=e=>{let{links:t}=e;return(0,z.jsx)("div",{style:{boxShadow:"var(--rp-shadow-3)",marginRight:"-2px",border:"1px solid var(--rp-c-divider-light)",background:"var(--rp-c-bg)"},className:"absolute top-8 right-0 z-1 p-3 w-32 rounded-2xl flex flex-wrap gap-4",children:t.map(e=>(0,z.jsx)(im,{link:e,popperStyle:{top:"1.25rem"}},e.content))})},iv=({socialLinks:e})=>{let t=e.length>3,n=[],i=[];e.forEach((e,t)=>{t<3?n.push(e):i.push(e)});let[r,a]=(0,T.useState)(!1);return(0,z.jsxs)("div",{className:`social-links ${ih.menuItem} flex-center relative`,onMouseLeave:()=>a(!1),children:[(0,z.jsx)(ig,{links:n,moreIconVisible:t,mouseEnter:()=>a(!0)}),r?(0,z.jsx)(ix,{links:i}):null]})};function ib(){var e,t;let{siteData:n,page:i}=(0,_.Vi)(),r=(0,_.aw)(),{pathname:a,search:o}=(0,O.TH)(),l=n.lang||"",s=n.multiVersion.default||"",d=Object.values(n.locales||n.themeConfig.locales||{}),c=(null==(e=n.route)?void 0:e.cleanUrls)||!1,u=d.length>1,{lang:h,pageType:p}=i,{base:m}=n;return u?{text:(0,z.jsx)(nx,{icon:tr,style:{width:"18px",height:"18px"}}),items:d.map(e=>({text:null==e?void 0:e.label,link:(0,F.$U)(a+o,{current:h,target:e.lang,default:l},{current:r,default:s},m,c,"404"===p)})),activeValue:null==(t=d.find(e=>h===e.lang))?void 0:t.label}:null}function iy(){var e;let{siteData:t,page:n}=(0,_.Vi)(),i=(0,_.aw)(),{pathname:r}=(0,O.TH)(),a=(null==(e=t.route)?void 0:e.cleanUrls)||!1,o=t.multiVersion.default||"",l=t.multiVersion.versions||[],{base:s}=t;return{items:l.map(e=>({text:e,link:(0,F.xM)(r,{current:i,target:e,default:o},s,a,"404"===n.pageType)})),text:i,activeValue:i}}var iw={navScreen:"navScreen_457e8",active:"active_457e8",container:"container_457e8",navMenu:"navMenu_457e8",navMenuItem:"navMenuItem_457e8",navAppearance:"navAppearance_457e8",socialAndAppearance:"socialAndAppearance_457e8",navScreenMenuGroup:"navScreenMenuGroup_457e8",open:"open_457e8",button:"button_457e8",buttonSpan:"buttonSpan_457e8",items:"items_457e8",down:"down_457e8"};function ik(e){let{activeValue:t}=e,[n,i]=(0,T.useState)(!1);function r({item:e}){return(0,z.jsx)("div",{className:"p-1 text-center",children:(0,z.jsx)("span",{className:"text-brand",children:e.text})})}function a({item:e}){return(0,z.jsx)("div",{className:"py-1 font-medium",children:(0,z.jsx)(is,{href:e.link,children:(0,z.jsx)("div",{children:(0,z.jsx)("div",{className:"flex justify-center",children:(0,z.jsx)("span",{children:e.text})})})})})}let o=e=>t===e.text?(0,z.jsx)(r,{item:e},e.link):(0,z.jsx)(a,{item:e},e.link),l=e=>(0,z.jsxs)("div",{children:["link"in e?o(e):(0,z.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(o)]});return(0,z.jsxs)("div",{className:`${n?iw.open:""} ${iw.navScreenMenuGroup} relative`,children:[(0,z.jsxs)("button",{className:iw.button,onClick:()=>{i(!n)},children:[(0,z.jsx)("span",{className:iw.buttonSpan,children:e.text}),(0,z.jsx)(ta,{className:`${n?iw.open:""} ${iw.down} `})]}),(0,z.jsx)("div",{children:(0,z.jsx)("div",{className:iw.items,children:e.items.map(e=>(0,z.jsx)("div",{children:"items"in e?l(e):o(e)},e.text))})})]})}function ij(){let{nav:e}=tT(),t=(0,_.aw)();return Array.isArray(e)?e:[...e[t.length>0?t:"default"]]}var iI=()=>{let e=ib();return(0,z.jsx)("div",{className:"flex text-sm font-bold justify-center",children:(0,z.jsx)("div",{className:"mx-1.5 my-1",children:(0,z.jsx)(ik,tj({},e))})})},iP=()=>{let e=iy();return(0,z.jsx)("div",{className:`${iw.navTranslations} flex text-sm font-bold justify-center`,children:(0,z.jsx)("div",{className:"mx-1.5 my-1",children:(0,z.jsx)(ik,tj({},e))})})};function iS(e){var t;let{isScreenOpen:n,siteData:i,pathname:r}=e,a=(0,T.useRef)(null),o=i.themeConfig.locales||[],l=o.length>1,s=i.multiVersion.versions.length>1,d=ij(),c=!1!==i.themeConfig.darkMode,u=(null==(t=null==i?void 0:i.themeConfig)?void 0:t.socialLinks)||[],h=u.length>0,p=o.map(e=>e.lang||"zh")||[],{base:m}=i;return(0,T.useEffect)(()=>(a.current&&n&&e9(a.current,{reserveScrollBarGap:!0}),()=>{te()}),[n]),(0,z.jsx)("div",{className:`${iw.navScreen} ${n?iw.active:""}`,ref:a,id:"navScreen",children:(0,z.jsxs)("div",{className:iw.container,children:[(0,z.jsx)(({menuItems:e})=>(0,z.jsx)("div",{className:iw.navMenu,children:e.map(e=>(0,z.jsx)("div",{className:`${iw.navMenuItem} w-full`,children:"link"in e?(0,z.jsx)(ic,tj({pathname:r,base:m,langs:p},e),e.text):(0,z.jsx)("div",{className:"mx-3 last:mr-0",children:(0,z.jsx)(ik,tI(tj({},e),{items:"items"in e?e.items:e}))},e.text)},e.text))}),{menuItems:d}),(0,z.jsxs)("div",{className:"flex-center flex-col gap-2",children:[c&&(0,z.jsx)(()=>(0,z.jsx)("div",{className:`mt-2 ${iw.navAppearance} flex justify-center`,children:(0,z.jsx)(H,{children:(0,z.jsx)(iu,{})})}),{}),l&&(0,z.jsx)(iI,{}),s&&(0,z.jsx)(iP,{}),h&&(0,z.jsx)(iv,{socialLinks:u})]})]})})}var iE={navHamburger:"navHamburger_e7b06",active:"active_e7b06"};function iC(e){let{siteData:t,pathname:n}=e,{isScreenOpen:i,toggleScreen:r}=function(){let{pathname:e}=(0,O.TH)(),[t,n]=(0,T.useState)(!1);function i(){n(!0),window.addEventListener("resize",a)}function r(){n(!1),window.removeEventListener("resize",a)}function a(){window.outerWidth>=768&&r()}return(0,T.useEffect)(()=>{r()},[e]),{isScreenOpen:t,openScreen:i,closeScreen:r,toggleScreen:function(){t?r():i()}}}();return(0,z.jsxs)(T.Fragment,{children:[(0,z.jsx)(iS,{isScreenOpen:i,siteData:t,pathname:n}),(0,z.jsx)("button",{onClick:r,"aria-label":"mobile hamburger",className:`${i?iE.active:""} ${iE.navHamburger} text-gray-500`,children:(0,z.jsx)(nx,{icon:eG,fill:"currentColor"})})]})}function i_({item:e}){return(0,z.jsxs)("div",{className:"rounded-2xl my-1 flex",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:[e.tag&&(0,z.jsx)(ru,{tag:e.tag}),(0,z.jsx)("span",{className:"text-brand",children:e.text})]},e.link)}function iN({item:e}){return(0,z.jsx)("div",{className:"font-medium my-1",children:(0,z.jsx)(is,{href:e.link,children:(0,z.jsx)("div",{className:"rounded-2xl hover:bg-mute",style:{padding:"0.4rem 1.5rem 0.4rem 0.75rem"},children:(0,z.jsxs)("div",{className:"flex",children:[e.tag&&(0,z.jsx)(ru,{tag:e.tag}),(0,z.jsx)("span",{children:e.text})]})})})},e.link)}function iz(e){let{activeValue:t,items:n,base:i="",link:r="",pathname:a=""}=e,[o,l]=(0,T.useState)(!1),s=e=>{let n=new RegExp(e.activeMatch||e.link).test((0,F.tz)(a,i));return t===e.text||!t&&n?(0,z.jsx)(i_,{item:e},e.link):(0,z.jsx)(iN,{item:e},e.link)},d=e=>(0,z.jsxs)("div",{children:["link"in e?s(e):(0,z.jsx)("p",{className:"font-bold text-gray-400 my-1 not:first:border",children:e.text}),e.items.map(s)]});return(0,z.jsxs)("div",{className:"relative flex-center h-14",onMouseLeave:()=>l(!1),children:[(0,z.jsx)("button",{onMouseEnter:()=>l(!0),className:"rspress-nav-menu-group-button flex-center items-center font-medium text-sm text-text-1 hover:text-text-2 transition-colors duration-200",children:r?(0,z.jsx)(ic,tI(tj({},e),{rightIcon:(0,z.jsx)(nx,{icon:ta})})):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("span",{className:"text-sm font-medium flex",style:{marginRight:"2px"},children:[(0,z.jsx)(ru,{tag:e.tag}),e.text]}),(0,z.jsx)(nx,{icon:ta})]})}),(0,z.jsx)("div",{className:"rspress-nav-menu-group-content absolute mx-0.8 transition-opacity duration-300",style:{opacity:o?1:0,visibility:o?"visible":"hidden",right:0,top:"52px"},children:(0,z.jsx)("div",{className:"p-3 pr-2 w-full h-full max-h-100vh whitespace-nowrap",style:{boxShadow:"var(--rp-shadow-3)",zIndex:100,border:"1px solid var(--rp-c-divider-light)",borderRadius:"var(--rp-radius-large)",background:"var(--rp-c-bg)"},children:n.map(e=>(0,z.jsx)("div",{children:"items"in e?d(e):s(e)},e.text))})})]})}var iA=()=>{var e;let{siteData:t}=(0,_.Vi)(),n=tT(),{logo:i,logoText:r}=t,a=null!=(e=n.title)?e:t.title,o=(0,T.useMemo)(()=>i?"string"==typeof i?(0,z.jsx)("img",{src:(0,N.i6)(i),alt:"logo",id:"logo",className:"mr-4 rspress-logo"}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("img",{src:(0,N.i6)(i.light),alt:"logo",id:"logo",className:"mr-4 rspress-logo dark:hidden"}),(0,z.jsx)("img",{src:(0,N.i6)(i.dark),alt:"logo",id:"logo",className:"mr-4 rspress-logo hidden dark:block"})]}):null,[i]);return(0,z.jsx)("div",{className:`${id.navBarTitle}`,children:(0,z.jsxs)("a",{href:(0,N.pJ)(n.langRoutePrefix||"/"),className:"flex items-center w-full h-full text-base font-semibold transition-opacity duration-300 hover:opacity-60",children:[o,r&&(0,z.jsx)("span",{children:r}),!o&&!r&&(0,z.jsx)("span",{children:a})]})})};function iT(){let e=ib();return(0,z.jsx)("div",{className:`translation ${id.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,z.jsx)("div",{children:(0,z.jsx)(iz,tj({},e))})})}function iO(){let e=iy();return(0,z.jsx)("div",{className:`translation ${id.menuItem} flex text-sm font-bold items-center px-3 py-2`,children:(0,z.jsx)("div",{children:(0,z.jsx)(iz,tj({},e))})})}function iM(e){var t;let{beforeNavTitle:n,afterNavTitle:i,beforeNav:r,afterNavMenu:a}=e,{siteData:o}=(0,_.Vi)(),{base:l}=o,{pathname:s}=(0,O.TH)(),[d,c]=(0,T.useState)(!1),u=tB(),h=Object.values(o.locales||o.themeConfig.locales||{}),p=h.length>1,m=o.multiVersion.versions.length>1,f=o.themeConfig.socialLinks||[],g=f.length>0,x=h.map(e=>e.lang||"")||[],v=()=>{c(no())};(0,T.useEffect)(()=>(window.addEventListener("resize",v),c(no()),()=>{window.removeEventListener("resize",v)}),[]);let b=({menuItems:e})=>(0,z.jsx)("div",{className:"rspress-nav-menu menu h-14",children:e.map(e=>"items"in e||Array.isArray(e)?(0,z.jsx)("div",{className:"mx-3 last:mr-0",children:(0,z.jsx)(iz,tI(tj({},e),{base:l,pathname:s,langs:x,items:"items"in e?e.items:e}))},e.text):(0,z.jsx)(ic,tj({pathname:s,langs:x,base:l},e),e.link))}),y=ij(),w=e=>{var t;return null!=(t=e.position)?t:"right"},k=y.filter(e=>"left"===w(e)),j=y.filter(e=>"right"===w(e)),I=(null==(t=null==o?void 0:o.themeConfig)?void 0:t.search)!==!1,P=!1!==o.themeConfig.darkMode;return(0,z.jsxs)(z.Fragment,{children:[r,(0,z.jsx)("div",{className:`${id.navContainer} rspress-nav px-6 ${u&&!d?id.hidden:""}`,style:{position:d?"relative":"sticky"},children:(0,z.jsxs)("div",{className:`${id.container} flex justify-between items-center h-full`,children:[n,(0,z.jsx)(iA,{}),i,(0,z.jsxs)("div",{className:"flex flex-1 justify-end items-center",children:[k.length>0?(0,z.jsx)("div",{className:id.leftNav,children:(0,z.jsx)(b,{menuItems:k})}):null,(0,z.jsxs)("div",{className:id.rightNav,children:[I&&(0,z.jsx)("div",{className:"flex sm:flex-1 items-center sm:pl-4 sm:pr-2",children:(0,z.jsx)(i5,{})}),(0,z.jsx)(b,{menuItems:j}),(0,z.jsxs)("div",{className:"flex-center flex-row",children:[p&&(0,z.jsx)(iT,{}),m&&(0,z.jsx)(iO,{}),P&&(0,z.jsx)("div",{className:"mx-2",children:(0,z.jsx)(iu,{})}),g&&(0,z.jsx)(iv,{socialLinks:f})]})]}),a,(0,z.jsxs)("div",{className:id.mobileNavMenu,children:[d&&I&&(0,z.jsx)(i5,{}),(0,z.jsx)(iC,{siteData:o,pathname:s})]})]})]})})]})}var iL={"header-anchor":"header-anchor_8f375",headerAnchor:"header-anchor_8f375","overview-groups":"overview-groups_8f375",overviewGroups:"overview-groups_8f375","overview-group-li":"overview-group-li_8f375",overviewGroupLi:"overview-group-li_8f375","level-2":"level-2_8f375",level2:"level-2_8f375","level-3":"level-3_8f375",level3:"level-3_8f375","level-4":"level-4_8f375",level4:"level-4_8f375","overview-group":"overview-group_8f375",overviewGroup:"overview-group_8f375",header:"header_8f375"};function iR(e){var t;let{siteData:n,page:{routePath:i,title:r,frontmatter:a}}=(0,_.Vi)(),{content:o,groups:l,defaultGroupTitle:s="Others"}=e,d=e=>(0,N.pJ)(e).startsWith(i.replace(/overview$/,""))&&!(0,N.pV)((0,N.pJ)(e),i),c=e=>"link"in e&&e.link?e.link:"items"in e?c(e.items[0]):"",u=(e,t,n)=>{for(let i of e){if((0,N.pJ)(i.link)===t)return[i];if(i.items){let e=u(i.items,t,n);if(e)return e}}return n},{pages:h}=n,p=h.filter(e=>d(e.routePath)),{items:m}=tM();function f(t,n,r){var a,o,l,s,d;if("dividerType"in t)return t;if((0,N.pJ)(t.link)===`${i}index`&&(null==r?void 0:r.overview)===!0)return!1;let u=null!=(s=null!=(l=null!=(o=null!=(a=null==e?void 0:e.overviewHeaders)?a:t.overviewHeaders)?o:null==r?void 0:r.overviewHeaders)?l:null==n?void 0:n.overviewHeaders)?s:[2],h=p.find(e=>(0,N.pV)(e.routePath,(0,N.pJ)(t.link||""))),m=c(t);return tI(tj({},t),{link:m,headers:(null==(d=null==h?void 0:h.toc)?void 0:d.filter(e=>u.some(t=>e.depth===t)))||[]})}(null==(t=m[0])?void 0:t.link)!==i&&(m=u(m,i,m));let g=e=>!("items"in e)&&"link"in e,x=null!=l?l:(0,T.useMemo)(()=>m.filter(e=>"items"in e&&e.items?e.items.filter(e=>d(c(e))).length>0:!!(g(e)&&d(c(e)))||!1).map(e=>{var t;let n=[];return(null==e?void 0:e.items)?n=null==(t=null==e?void 0:e.items)?void 0:t.map(t=>f(t,e,a)).filter(Boolean):g(e)&&(n=[f({link:e.link,text:e.text||"",tag:e.tag,_fileKey:e._fileKey,overviewHeaders:e.overviewHeaders},void 0,a)]),{name:e.text||"",items:n}}),[m,i,a]);return(0,z.jsxs)("div",{className:"overview-index mx-auto px-8",children:[(0,z.jsx)("div",{className:"flex items-center justify-between",children:!r&&(0,z.jsx)("h1",{className:"text-3xl leading-10 tracking-tight",children:"Overview"})}),o,x.map(e=>(0,z.jsxs)("div",{className:"mb-16",children:[e.name===s&&1===x.length?(0,z.jsx)("h2",{style:{paddingTop:0}}):(0,z.jsx)("h2",{children:nu(e.name)}),(0,z.jsx)("div",{className:iL.overviewGroups,children:e.items.map(e=>{var t;return(0,z.jsxs)("div",{className:iL.overviewGroup,children:[(0,z.jsx)("div",{className:"flex",children:(0,z.jsx)("h3",{style:{marginBottom:8},children:(0,z.jsx)(is,{href:(0,N.AP)(e.link),children:nu(e.text)})})}),(0,z.jsx)("ul",{className:"list-none",children:null==(t=e.headers)?void 0:t.map(t=>(0,z.jsx)("li",{className:`${iL.overviewGroupLi} ${iL[`level${t.depth}`]} first:mt-2`,children:(0,z.jsx)(is,{href:`${(0,N.AP)(e.link)}#${t.id}`,children:nu(t.text)})},t.id))})]},e.link)})})]},e.name))]})}function i$(e){return(0,z.jsxs)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 256 256"},e),{children:[(0,z.jsx)("path",{fill:"#C12127",d:"M0 256V0h256v256z"}),(0,z.jsx)("path",{fill:"#FFF",d:"M48 48h160v160h-32V80h-48v128H48z"})]}))}function iB(e){return(0,z.jsx)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:(0,z.jsxs)("g",{fill:"#2c8ebb",children:[(0,z.jsx)("path",{d:"M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"}),(0,z.jsx)("path",{d:"M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"})]})}))}function iD(e){return(0,z.jsxs)("svg",tI(tj({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 128 128"},e),{children:[(0,z.jsx)("path",{fill:"#f8ab00",d:"M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"}),(0,z.jsx)("path",{fill:"#4c4c4c",d:"M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"})]}))}function iH(e){return(0,z.jsxs)("svg",tI(tj({id:"Bun",width:"1.2em",height:"1.2em",viewBox:"0 0 80 70"},e),{children:[(0,z.jsx)("path",{id:"Shadow",d:"M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"}),(0,z.jsxs)("g",{id:"Body",children:[(0,z.jsx)("path",{id:"Background",d:"M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z",style:{fill:"#fbf0df"}}),(0,z.jsx)("path",{id:"Bottom_Shadow","data-name":"Bottom Shadow",d:"M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z",style:{fill:"#f6dece"}}),(0,z.jsx)("path",{id:"Light_Shine","data-name":"Light Shine",d:"M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z",style:{fill:"#fffefc"}}),(0,z.jsx)("path",{id:"Top",d:"M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z",style:{fill:"#ccbea7",fillRule:"evenodd"}}),(0,z.jsx)("path",{id:"Outline",d:"M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"})]}),(0,z.jsxs)("g",{id:"Mouth",children:[(0,z.jsx)("g",{id:"Background-2","data-name":"Background",children:(0,z.jsx)("path",{d:"M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z",style:{fill:"#b71422"}})}),(0,z.jsxs)("g",{id:"Tongue",children:[(0,z.jsx)("path",{id:"Background-3","data-name":"Background",d:"M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z",style:{fill:"#ff6164"}}),(0,z.jsx)("path",{id:"Outline-2","data-name":"Outline",d:"M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"})]}),(0,z.jsx)("path",{id:"Outline-3","data-name":"Outline",d:"M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"})]}),(0,z.jsxs)("g",{id:"Face",children:[(0,z.jsx)("ellipse",{id:"Right_Blush","data-name":"Right Blush",cx:"53.22",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,z.jsx)("ellipse",{id:"Left_Bluch","data-name":"Left Bluch",cx:"22.95",cy:"40.18",rx:"5.85",ry:"3.44",style:{fill:"#febbd0"}}),(0,z.jsx)("path",{id:"Eyes",d:"M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z",style:{fillRule:"evenodd"}}),(0,z.jsx)("path",{id:"Iris",d:"M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z",style:{fill:"#fff",fillRule:"evenodd"}})]})]}))}function iF(e){if(!(null==e?void 0:e.includes("install")))return e;let t=e.split(" ").filter(e=>!e.startsWith("-")&&!e.startsWith("--")).join(" ");return"yarn install"===t||"bun install"===t?e:e.replace("install","add")}function iW({command:e,additionalTabs:t=[]}){let n;let i={npm:(0,z.jsx)(i$,{}),yarn:(0,z.jsx)(iB,{}),pnpm:(0,z.jsx)(iD,{}),bun:(0,z.jsx)(iH,{})};return t.forEach(e=>{i[e.tool]=e.icon}),"string"==typeof e?(n={npm:`npm ${e}`,yarn:`yarn ${e}`,pnpm:`pnpm ${e}`,bun:`bun ${e}`},t.forEach(t=>{n[t.tool]=`${t.tool} ${e}`})):n=e,n.yarn&&(n.yarn=iF(n.yarn)),n.bun&&(n.bun=iF(n.bun)),(0,z.jsx)(iJ,{groupId:"package.manager",values:Object.entries(n).map(([e])=>(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",fontSize:15},children:[i[e],(0,z.jsx)("span",{style:{marginLeft:6,marginBottom:2},children:e})]},e)),children:Object.entries(n).map(([e,t])=>(0,z.jsx)(iQ,{children:(0,z.jsx)(nJ,{children:(0,z.jsx)(nK,{className:"language-js",codeHighlighter:"prism",children:t})})},e))})}var iq={pagerLink:"pager-link_9b9a7",title:"title_9b9a7",next:"next_9b9a7",desc:"desc_9b9a7"};function iU(e){let{type:t,text:n,href:i}=e,{prevPageText:r="Previous Page",nextPageText:a="Next page"}=tT(),o="prev"===t?iq.pagerLink:`${iq.pagerLink} ${iq.next}`;return(0,z.jsxs)(is,{href:i,className:o,children:[(0,z.jsx)("span",{className:iq.desc,children:"prev"===t?r:a}),(0,z.jsx)("span",{className:iq.title,children:n})]})}var iV={scrollToTop:"scroll-to-top_1a167",entered:"entered_1a167"};function iG(){let[e,t]=(0,T.useState)(!1),n=()=>{t((window.scrollY||document.documentElement.scrollTop)>0)};return(0,T.useEffect)(()=>{window.addEventListener("scroll",n)},[]),(0,z.jsx)("button",{className:`${iV.scrollToTop} ${e?iV.entered:""}`,onClick:()=>{window.scrollTo({top:0,behavior:"smooth"})},children:(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-6 h-6",children:(0,z.jsx)("path",{fillRule:"evenodd",d:"M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06l7.5-7.5Z",clipRule:"evenodd"})})})}var iZ={mask:"mask_6e282",modal:"modal_6e282",inputForm:"inputForm_6e282",input:"input_6e282",close:"close_6e282",searchHits:"searchHits_6e282",groupTitle:"groupTitle_6e282",navSearchButton:"navSearchButton_6e282",searchWord:"searchWord_6e282",suggestItem:"suggestItem_6e282",suggestItemContainer:"suggestItemContainer_6e282",contentWrapper:"contentWrapper_6e282",mark:"mark_6e282",titleForContent:"titleForContent_6e282",actionIcon:"actionIcon_6e282",current:"current_6e282",tabClassName:"tabClassName_6e282",mobileNavSearchButton:"mobileNavSearchButton_6e282"},iY={container:"container_fa768",tabList:"tab-list_fa768",tab:"tab_fa768",notSelected:"not-selected_fa768",selected:"selected_fa768",noScrollbar:"no-scrollbar_fa768"},iK=e=>{var t;return(t=e)&&"object"==typeof t&&"label"in t?e.label||e.value:e},iJ=(0,T.forwardRef)((e,t)=>{let{values:n,defaultValue:i,onChange:r,children:a,groupId:o,tabPosition:l="left",tabContainerClassName:s}=e,d=T.Children.toArray(a).filter(e=>!("string"==typeof e&&""===e.trim())),c=n||[];0===c.length&&(c=T.Children.map(d,e=>{var t,n,i;return(0,T.isValidElement)(e)?{label:null==(t=e.props)?void 0:t.label,value:(null==(n=e.props)?void 0:n.value)||(null==(i=e.props)?void 0:i.label)}:{label:void 0,value:void 0}}));let{tabData:u,setTabData:h}=(0,T.useContext)(nb),[p,m]=(0,T.useState)(()=>void 0===i?0:c.findIndex(e=>"string"==typeof e?e===i:!!e&&"object"==typeof e&&"value"in e&&e.value===i)),[f,g]=nt(`rspress.tabs.${o}`,p),x=(0,T.useMemo)(()=>{if(o)return void 0!==u[o]?u[o]:Number.parseInt(f);return p},[u[o]]);(0,T.useEffect)(()=>{if(o){let e=Number.parseInt(f);x!==e&&h(tI(tj({},u),{[o]:e}))}},[f]);let v=o?x:p;return(0,z.jsxs)("div",{className:iY.container,ref:t,children:[(0,z.jsx)("div",{className:s,children:c.length?(0,z.jsx)("div",{className:`${iY.tabList} ${iY.noScrollbar}`,style:{justifyContent:"center"===l?"center":"flex-start"},children:c.map((e,t)=>(0,z.jsx)("div",{className:`${iY.tab} ${v===t?iY.selected:iY.notSelected}`,onClick:()=>{null==r||r(t),o?(h(tI(tj({},u),{[o]:t})),g(t)):m(t)},children:iK(e)},t))}):null}),(0,z.jsx)("div",{children:T.Children.toArray(d)[v]})]})});function iQ(e){var{children:t}=e,n=tP(e,["children"]);return(0,z.jsx)("div",tI(tj({},n),{className:"rounded px-2",children:t}))}function iX({query:e}){let{searchNoResultsText:t="No results for",searchSuggestedQueryText:n="Please try again with a different keyword"}=tT();return(0,z.jsxs)("div",{className:"flex flex-col items-center pt-8 pb-2",children:[(0,z.jsx)(nx,{icon:th,className:"mb-4 opacity-80"}),(0,z.jsxs)("p",{className:"mb-2",children:[t," ",(0,z.jsxs)("b",{children:['"',e,'"']})]}),(0,z.jsx)("p",{children:n})]})}var i0={title:e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M4 4a2 2 0 0 1 2-2h8a1 1 0 0 1 .707.293l5 5A1 1 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4zm13.586 4L14 4.414V8h3.586zM12 4H6v16h12V10h-5a1 1 0 0 1-1-1V4z"})}),header:e=>(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:(0,z.jsx)("path",{fill:"currentColor",d:"M28 12v-2h-6V4h-2v6h-8V4h-2v6H4v2h6v8H4v2h6v6h2v-6h8v6h2v-6h6v-2h-6v-8Zm-8 8h-8v-8h8Z"})}),content:e=>(0,z.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 32 32",...e,children:[(0,z.jsx)("circle",{cx:22,cy:24,r:2,fill:"currentColor"}),(0,z.jsx)("path",{fill:"none",d:"M22 28a4 4 0 1 1 4-4 4.004 4.004 0 0 1-4 4Zm0-6a2 2 0 1 0 2 2 2.003 2.003 0 0 0-2-2Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M29.777 23.479A8.64 8.64 0 0 0 22 18a8.64 8.64 0 0 0-7.777 5.479L14 24l.223.521A8.64 8.64 0 0 0 22 30a8.64 8.64 0 0 0 7.777-5.479L30 24ZM22 28a4 4 0 1 1 4-4 4.005 4.005 0 0 1-4 4Z"}),(0,z.jsx)("path",{fill:"currentColor",d:"M12 28H8V4h8v6a2.006 2.006 0 0 0 2 2h6v4h2v-6a.91.91 0 0 0-.3-.7l-7-7A.909.909 0 0 0 18 2H8a2.006 2.006 0 0 0-2 2v24a2.006 2.006 0 0 0 2 2h4Zm6-23.6 5.6 5.6H18Z"})]})};function i1({suggestion:e,closeSearch:t,isCurrent:n,setCurrentSuggestionIndex:i,inCurrentDocIndex:r,scrollTo:a}){var o,l;let s=i0[e.type],d=r&&!(0,F.yv)()?tY(e.link):e.link,c=(0,T.useRef)(null);n&&a(null==(o=null==c?void 0:c.current)?void 0:o.offsetTop,null==(l=null==c?void 0:c.current)?void 0:l.offsetHeight);let u=(e,t)=>{let n=[],i=0;for(let l of t){var r,a,o;let{start:t,length:s}=l,d=e.slice(i,t);let c=(r=e,a=t,o=s,function(e,t,n){let i="",r=0,a=e.length;for(let o=0;o0+n);o++){;r>t&&(i+=e.charAt(o))}return i}(r.slice(a),0,o));n.push(d),n.push((0,z.jsx)("span",{className:iZ.mark,children:c},t)),i=t+c.length}return i{if("header"===e.type||"title"===e.type){let{header:t,highlightInfoList:n}=e;return(0,z.jsx)("div",{className:"font-medium",children:u(t,n)})}return(0,z.jsx)("div",{className:"font-medium",children:e.header})})();break;case"content":h=(0,z.jsxs)(z.Fragment,{children:[(()=>{if("content"!==e.type)return(0,z.jsx)("div",{});let{statement:t,highlightInfoList:n}=e;return(0,z.jsx)("div",{className:"text-sm text-gray-light w-full",children:u(t,n)})})(),(0,z.jsx)("p",{className:iZ.titleForContent,children:e.title})]})}return(0,z.jsx)("li",{className:`${iZ.suggestItem} ${n?iZ.current:""}`,onMouseEnter:i,ref:c,children:(0,z.jsx)("a",{href:d,onClick:e=>{t(),e.stopPropagation()},target:r?"_self":"_blank",children:(0,z.jsxs)("div",{className:iZ.suggestItemContainer,children:[(0,z.jsx)("div",{className:iZ.hitIcon,children:(0,z.jsx)(nx,{icon:s})}),(0,z.jsx)("div",{className:iZ.contentWrapper,children:(0,z.jsx)("span",{children:h})}),(0,z.jsx)("div",{className:iZ.actionIcon,children:(0,z.jsx)(nx,{icon:tp})})]})})},e.link)}var i2={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ENTER:"Enter",SEARCH:"KeyK",ESC:"Escape"},i3=e=>{let t=(0,T.useRef)(e);return t.current=e,(0,T.useCallback)((0,tl.Z)((...e)=>t.current(...e),150),[])};function i4({focused:e,setFocused:t}){var n,i,r,a;let[o,l]=(0,T.useState)(""),[s,d]=(0,T.useState)([]),c=(0,T.useRef)(null),[u,h]=(0,T.useState)(!0),[p,m]=(0,T.useState)(!1),[f,g]=(0,T.useState)(0),[x,v]=(0,T.useState)(0),b=(0,T.useRef)(null),y=(0,T.useRef)(null),w=(0,T.useRef)(null),k=(0,T.useRef)(null),[j,I]=(0,T.useState)(!1),P=(e,t)=>{var n,i,r,a,o;if(j){let l=e+t-(null==(n=null==w?void 0:w.current)?void 0:n.offsetHeight)-(1===s.length?50:-10);l>(null==(i=null==w?void 0:w.current)?void 0:i.scrollTop)&&(null==(r=null==w?void 0:w.current)||r.scrollTo({top:l}));let d=1===s.length?e-70:e-10;d<(null==(a=null==w?void 0:w.current)?void 0:a.scrollTop)&&(null==(o=null==w?void 0:w.current)||o.scrollTo({top:d}))}},{siteData:S,page:{lang:E,version:N}}=(0,_.Vi)(),{sidebar:A,searchPlaceholderText:O="Search Docs"}=tT(),{search:M,title:L}=S,R=M&&"remote"!==M.mode&&M.versioned,$=[{group:L,result:[],renderType:"default"}],B=null!=(i=null==(n=s[f])?void 0:n.result)?i:[],D=null!=(a=null==(r=s[f])?void 0:r.renderType)?a:"default",H=e=>tO(A,e).group;function W(){return tz(this,null,function*(){var e,t;if(!1===M)return;let n={currentLang:E,currentVersion:N,extractGroupName:H},i=new t6(tj(tj({indexName:L},M),n));b.current=i,y.current=n,yield b.current.init(),h(!1);let r=null==(e=c.current)?void 0:e.value;r&&(d((yield null==(t=b.current)?void 0:t.match(r))||$),m(!1))})}let q=()=>{t(!1),g(0),v(0)};(0,T.useEffect)(()=>{let n=n=>{switch(n.code){case i2.SEARCH:(n.ctrlKey||n.metaKey)&&(n.preventDefault(),t(!e));break;case i2.ARROW_DOWN:e&&(n.preventDefault(),B&&"default"===D&&(I(!0),v((x+1)%B.length)));break;case i2.ARROW_UP:if(e&&(n.preventDefault(),"default"===D)){let e=B.length;I(!0),v((x-1+e)%e)}break;case i2.ENTER:if(x>=0&&"default"===D){let e=[].concat(...Object.values(V(B)))[x];0===f?window.location.href=(0,F.yv)()?e.link:tY(e.link):window.open(e.link),q()}break;case i2.ESC:q()}};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[v,t,e,f,B,x]),(0,T.useEffect)(()=>{e?(d($),!b.current&&W()):l("")},[e]),(0,T.useEffect)(()=>{var e;let{currentLang:t,currentVersion:n}=null!=(e=y.current)?e:{},i=E!==t,r=R&&N!==n;!u&&(i||r)&&W()},[E,N,R]);let U=i3(e=>tz(this,null,function*(){var t,n;let i=e;if(l(i),M&&"remote"===M.mode&&M.searchLoading&&m(!0),i){let e=[];if("beforeSearch"in C){let e=yield C.beforeSearch(i);e&&(i=e)}let r=yield null==(t=b.current)?void 0:t.match(i);if(r&&e.push(...r),"onSearch"in C){let t=yield C.onSearch(i,e);t&&e.push(...t.map(e=>tj({renderType:"custom"},e)))}"afterSearch"in C&&(yield C.afterSearch(i,e)),(null==(n=c.current)?void 0:n.value)===i&&(d(e||$),m(!1))}})),V=e=>(0,ts.Z)(e,"group"),G=(e,t,n)=>{if(n)return(0,z.jsx)("div",{className:"flex flex-col items-center",children:(0,z.jsx)(nx,{icon:tu,className:"m-8 opacity-80"})});if(0===e.length&&!u)return(0,z.jsx)(iX,{query:t});let i=V(e),r=-1;return(0,z.jsx)("ul",{className:iZ.suggestList,children:Object.keys(i).map(e=>{let t=i[e]||[];return(0,z.jsx)("li",{children:(0,z.jsx)("ul",{className:"pb-2",children:t.map(e=>{let t=++r;return(0,z.jsx)(i1,{suggestion:e,isCurrent:t===x,setCurrentSuggestionIndex:()=>{I(!1),v(t)},closeSearch:()=>{q()},inCurrentDocIndex:0===f,scrollTo:P},`${e.title}-${t}`)})})},e)})})};return(0,z.jsx)(z.Fragment,{children:e&&(0,er.createPortal)((0,z.jsx)("div",{className:iZ.mask,onClick:()=>{q()},children:(0,z.jsxs)("div",{className:`${iZ.modal}`,onClick:e=>{t(!0),e.stopPropagation()},children:[(0,z.jsxs)("div",{className:"flex items-center",children:[(0,z.jsxs)("div",{className:iZ.inputForm,children:[(0,z.jsx)("label",{children:(0,z.jsx)(nx,{icon:to})}),(0,z.jsx)("input",{className:iZ.input,ref:c,placeholder:O,"aria-label":"Search",autoComplete:"off",autoFocus:!0,onChange:e=>U(e.target.value)}),(0,z.jsx)("label",{children:(0,z.jsx)(nx,{icon:tc,className:iZ.close,onClick:e=>{c.current&&(e.stopPropagation(),o?(c.current.value="",l("")):q())}})})]}),(0,z.jsx)("h2",{className:"text-brand ml-2 sm:hidden cursor-pointer",onClick:e=>{e.stopPropagation(),q()},children:"Cancel"})]}),o&&!u?(0,z.jsx)("div",{className:`${iZ.searchHits} rspress-scrollbar`,ref:w,children:((e,t,n)=>{if(1===e.length){let t=e[0].result;return 0!==t.length||n?(0,z.jsx)("div",{ref:k,children:G(t,o,n)}):(0,z.jsx)(iX,{query:o})}let i=e.map(e=>t&&"remote"===t.mode?tJ(t.searchIndexes||[]).find(t=>t.value===e.group).label:e.group);return(0,z.jsx)(iJ,{values:i,tabContainerClassName:iZ.tabClassName,onChange:e=>{g(e),v(0)},ref:k,children:e.map(e=>(0,z.jsxs)(iQ,{children:["default"===e.renderType&&G(e.result,o,n),"custom"===e.renderType&&C.render(e.result)]},e.group))})})(s,M,p)}):null]})}),document.getElementById("search-container"))})}function i5(){let[e,t]=(0,T.useState)(!1),[n,i]=(0,T.useState)(null),{searchPlaceholderText:r="Search Docs"}=tT();return(0,T.useEffect)(()=>{i(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?"\u2318":"Ctrl")},[]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{className:`rspress-nav-search-button ${iZ.navSearchButton}`,onClick:()=>t(!0),children:(0,z.jsxs)("button",{children:[(0,z.jsx)(nx,{icon:to,width:"18",height:"18"}),(0,z.jsx)("p",{className:iZ.searchWord,children:r}),(0,z.jsxs)("div",{style:{opacity:n?1:0},children:[(0,z.jsx)("span",{children:n}),(0,z.jsx)("span",{children:"K"})]})]})}),(0,z.jsx)("div",{className:iZ.mobileNavSearchButton,onClick:()=>t(!0),children:(0,z.jsx)(nx,{icon:to})}),(0,z.jsx)(i4,{focused:e,setFocused:t})]})}var i6={navTitleMask:"navTitleMask_71eca",sidebar:"sidebar_71eca",sidebarContent:"sidebarContent_71eca",open:"open_71eca",menuLink:"menuLink_71eca",menuItem:"menuItem_71eca",collapseContainer:"collapseContainer_71eca",menuItemActive:"menuItemActive_71eca"};function i7(e){let{depth:t,dividerType:n}=e;return(0,z.jsx)("div",{className:`${"dashed"===n?"border-dashed":"border-solid"} border-t border-divider-light my-3`,style:{marginLeft:0===t?0:"18px"}})}function i8(e){var t;let{item:n,depth:i=0,activeMatcher:r,id:a,setSidebarData:o}=e,l=(0,O.s0)(),s=(0,T.useRef)(null),d=(0,T.useRef)(null),c=(0,T.useRef)(null),u=(0,T.useRef)(!0),h=(0,T.useRef)(n.collapsed),p=n.link&&r(n.link),{collapsed:m,collapsible:f=!0}=n,g=(0,z.jsx)("div",{style:{cursor:"pointer",transition:"transform 0.2s ease-out",transform:m?"rotate(0deg)":"rotate(90deg)"},children:(0,z.jsx)(nx,{icon:Q})});(0,T.useEffect)(()=>{if(u.current||!s.current||!c.current)return;d.current&&clearTimeout(d.current);let e=s.current,t=c.current,n=t.clientHeight+4;m?(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.5s",t.style.opacity="0",d.current=setTimeout(()=>{s.current&&(s.current.style.maxHeight="0px")},0)):(e.style.maxHeight=`${n}px`,e.style.transitionDuration="0.3s",t.style.opacity="1",d.current=setTimeout(()=>{s.current&&s.current.style.removeProperty("max-height")},300))},[m]),(0,T.useEffect)(()=>{u.current=!1},[]);let x=e=>{e.stopPropagation(),o(e=>{let t=[...e],n=a.split("-").map(Number),i=t[n.shift()];for(let e of n)i=i.items[e];return"items"in i&&(i.collapsed=!i.collapsed),t})};return(0,z.jsxs)("section",{className:"mt-0.5 block","data-context":n.context,style:{marginLeft:0===i?0:"18px"},children:[(0,z.jsxs)("div",{className:`flex justify-between items-center ${p?i6.menuItemActive:i6.menuItem}`,onMouseEnter:()=>n.link&&e.preloadLink(n.link),onClick:e=>{n.link&&l((0,N.pJ)((0,N.AP)(n.link))),f&&x(e)},style:{borderRadius:0===i?"0 var(--rp-radius) var(--rp-radius) 0":void 0,cursor:f||n.link?"pointer":"normal"},children:[(0,z.jsxs)("h2",{className:"py-2 px-3 text-sm font-medium flex",style:tj({},0===i?rr:{}),children:[(0,z.jsx)(ru,{tag:n.tag}),(0,z.jsx)("span",{className:"flex-center",children:nu(n.text)})]}),f&&(0,z.jsx)("div",{className:`${i6.collapseContainer} p-2 rounded-xl`,onClick:x,children:g})]}),(0,z.jsx)("div",{ref:s,className:"transition-all duration-300 ease-in-out",style:{overflow:"hidden",maxHeight:h.current?0:void 0},children:(0,z.jsx)("div",{ref:c,className:"rspress-sidebar-group transition-opacity duration-500 ease-in-out",style:{opacity:h.current?0:1,marginLeft:0===i?"12px":0},children:null==(t=null==n?void 0:n.items)?void 0:t.map((t,n)=>"dividerType"in t?(0,z.jsx)(i7,{depth:i+1,dividerType:t.dividerType},n):(0,z.jsx)("div",{"data-context":t.context,children:(0,z.jsx)(re,tI(tj({},e),{item:t,depth:i+1,id:`${a}-${n}`,preloadLink:e.preloadLink}))},n))})})]},a)}var i9=e=>e.replace(/\.(mdx?)$/,"");function re(e){let{item:t,depth:n=0,activeMatcher:i,id:r,setSidebarData:a}=e,o="link"in t&&t.link&&i(t.link),{page:l}=(0,_.Vi)(),s=(0,T.useRef)(null),d=(0,T.useRef)(t.text),c=function(){let[,e]=(0,T.useState)(0);return()=>{e(e=>e+1)}}();return((0,T.useEffect)(()=>{var e;o&&(null==(e=s.current)||e.scrollIntoView({block:"center"}))},[]),!(0,F.yv)()&&t._fileKey===i9(l.pagePath)&&l.title&&(d.current=l.title),(0,T.useEffect)(()=>{if(t.text!==d.current)d.current=t.text,c()},[t.text]),"items"in t)?(0,z.jsx)(i8,{id:r,item:t,depth:n,activeMatcher:i,collapsed:t.collapsed,setSidebarData:a,preloadLink:e.preloadLink},`${t.text}-${r}`):(0,z.jsx)(is,{href:(0,N.AP)(t.link),className:i6.menuLink,children:(0,z.jsxs)("div",{ref:s,onMouseEnter:()=>e.preloadLink(t.link),className:`${o?i6.menuItemActive:i6.menuItem} mt-0.5 py-2 px-3 font-medium flex`,style:tj({fontSize:0===n?"14px":"13px",marginLeft:0===n?0:"18px",borderRadius:"0 var(--rp-radius) var(--rp-radius) 0"},0===n?rr:{}),children:[(0,z.jsx)(ru,{tag:t.tag}),(0,z.jsx)("span",{children:nu(d.current)})]})})}function rt({sectionHeaderText:e,tag:t}){return(0,z.jsxs)("div",{className:"rspress-sidebar-section-header",children:[(0,z.jsx)(ru,{tag:t}),(0,z.jsx)("span",{children:nu(e)})]})}var rn=e=>"dividerType"in e,ri=e=>"sectionHeaderText"in e,rr={fontSize:"14px",paddingLeft:"24px",fontWeight:"bold"},ra=new WeakMap;function ro(e){let{isSidebarOpen:t,beforeSidebar:n,afterSidebar:i,uiSwitch:r}=e,{pathname:a}=(0,O.TH)(),{items:o}=tM(),[l,s]=(0,T.useState)(()=>o.filter(Boolean).flat()),d=tT(),c=decodeURIComponent(a),u=(0,F.Kw)(d.langRoutePrefix||"");(0,T.useEffect)(()=>{F._f&&(t?(E=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=E||"")},[t]),(0,T.useEffect)(()=>{if(o===l)return;ra=new WeakMap;let e=t=>ra.has(t)?ra.get(t):"link"in t&&t.link&&p(t.link)||"items"in t&&t.items.some(t=>e(t))?(ra.set(t,!0),!0):(ra.set(t,!1),!1),t=n=>{"items"in n&&(n.items.forEach(t),e(n)&&(n.collapsed=!1))},n=o.filter(Boolean).flat();n.forEach(t),s(n)},[o,c]);let h=e=>e.replace(u,""),p=e=>na((0,N.E9)(h(c)),h(e),!0),m=e=>{let t=(0,M.fp)(eV.routes,e);if(null==t?void 0:t.length){let{route:e}=t[0];e.preload()}};return(0,z.jsxs)("aside",{className:`${i6.sidebar} rspress-sidebar ${t?i6.open:""}`,children:[r.showNavbar?(0,z.jsx)("div",{className:i6.navTitleMask,children:(0,z.jsx)(iA,{})}):null,(0,z.jsx)("div",{className:`rspress-scrollbar ${i6.sidebarContent}`,children:(0,z.jsxs)("nav",{className:"pb-2",children:[n,l.map((e,t)=>{var n;return rn(e)?(0,z.jsx)(i7,{depth:0,dividerType:e.dividerType},t):ri(e)?(0,z.jsx)(rt,{sectionHeaderText:e.sectionHeaderText,tag:e.tag},t):(0,z.jsx)(re,{id:String(t),item:e,depth:0,activeMatcher:p,collapsed:null==(n=e.collapsed)||n,setSidebarData:s,preloadLink:m},t)}),i]})})]})}var rl="sourceCode_bf1b0";function rs(e){let{href:t,platform:n="github"}=e,{sourceCodeText:i="Source"}=tT();return(0,z.jsx)("div",{className:`inline-block rounded border border-solid border-gray-light-3 dark:border-divider text-gray-400 ${rl}`,children:(0,z.jsxs)("a",{href:t,target:"_blank",className:"flex items-center content-center transition-all duration-300 text-xs block px-2 py-1 ",children:[(0,z.jsx)("span",{className:"mr-2 inline-flex w-4 h-4",children:(0,z.jsx)(nx,{icon:"gitlab"===n?tf:tm})}),(0,z.jsx)("span",{children:i})]})})}var rd="rspressSteps_38f64";function rc({children:e}){return(0,z.jsx)("div",{className:`ml-4 mb-11 border-l pl-6 ${rd} [counter-reset:step]`,children:e})}var ru=({tag:e})=>e?e.trim().startsWith("(0,z.jsx)("li",{children:(0,z.jsx)("a",{href:`#${e.id}`,className:"rspress-toc-link sm:text-normal text-sm",style:{marginLeft:(e.depth-2)*12},onClick:n=>{n.preventDefault(),window.location.hash=e.id;let i=document.getElementById(e.id);i&&tH(i,!1),null==t||t(e)},children:(0,z.jsx)("span",{className:"rspress-toc-link-text block",children:nu(e.text)})})},e.id);function rp({onItemClick:e}){let{page:t}=(0,_.Vi)();return(0,z.jsx)("ul",{children:t.toc.map(t=>(0,z.jsx)(rh,{header:t,onItemClick:e},t.id))})}var rm={Layout:nj,NotFoundLayout:tA,HomeLayout:nI,setup:tW}},924:function(e){"use strict";e.exports=JSON.parse('{"AElig":"\xc6","AMP":"&","Aacute":"\xc1","Acirc":"\xc2","Agrave":"\xc0","Aring":"\xc5","Atilde":"\xc3","Auml":"\xc4","COPY":"\xa9","Ccedil":"\xc7","ETH":"\xd0","Eacute":"\xc9","Ecirc":"\xca","Egrave":"\xc8","Euml":"\xcb","GT":">","Iacute":"\xcd","Icirc":"\xce","Igrave":"\xcc","Iuml":"\xcf","LT":"<","Ntilde":"\xd1","Oacute":"\xd3","Ocirc":"\xd4","Ograve":"\xd2","Oslash":"\xd8","Otilde":"\xd5","Ouml":"\xd6","QUOT":"\\"","REG":"\xae","THORN":"\xde","Uacute":"\xda","Ucirc":"\xdb","Ugrave":"\xd9","Uuml":"\xdc","Yacute":"\xdd","aacute":"\xe1","acirc":"\xe2","acute":"\xb4","aelig":"\xe6","agrave":"\xe0","amp":"&","aring":"\xe5","atilde":"\xe3","auml":"\xe4","brvbar":"\xa6","ccedil":"\xe7","cedil":"\xb8","cent":"\xa2","copy":"\xa9","curren":"\xa4","deg":"\xb0","divide":"\xf7","eacute":"\xe9","ecirc":"\xea","egrave":"\xe8","eth":"\xf0","euml":"\xeb","frac12":"\xbd","frac14":"\xbc","frac34":"\xbe","gt":">","iacute":"\xed","icirc":"\xee","iexcl":"\xa1","igrave":"\xec","iquest":"\xbf","iuml":"\xef","laquo":"\xab","lt":"<","macr":"\xaf","micro":"\xb5","middot":"\xb7","nbsp":"\xa0","not":"\xac","ntilde":"\xf1","oacute":"\xf3","ocirc":"\xf4","ograve":"\xf2","ordf":"\xaa","ordm":"\xba","oslash":"\xf8","otilde":"\xf5","ouml":"\xf6","para":"\xb6","plusmn":"\xb1","pound":"\xa3","quot":"\\"","raquo":"\xbb","reg":"\xae","sect":"\xa7","shy":"\xad","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","szlig":"\xdf","thorn":"\xfe","times":"\xd7","uacute":"\xfa","ucirc":"\xfb","ugrave":"\xf9","uml":"\xa8","uuml":"\xfc","yacute":"\xfd","yen":"\xa5","yuml":"\xff"}')},3222:function(e){"use strict";e.exports=JSON.parse('{"0":"\uFFFD","128":"\u20AC","130":"\u201A","131":"\u0192","132":"\u201E","133":"\u2026","134":"\u2020","135":"\u2021","136":"\u02C6","137":"\u2030","138":"\u0160","139":"\u2039","140":"\u0152","142":"\u017D","145":"\u2018","146":"\u2019","147":"\u201C","148":"\u201D","149":"\u2022","150":"\u2013","151":"\u2014","152":"\u02DC","153":"\u2122","154":"\u0161","155":"\u203A","156":"\u0153","158":"\u017E","159":"\u0178"}')},8606:function(e){"use strict";e.exports=JSON.parse('["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]')}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/2970.23f1b858.js.LICENSE.txt b/modern-js/module-tools/static/js/2970.43a165d0.js.LICENSE.txt similarity index 100% rename from modern-js/module-tools/static/js/2970.23f1b858.js.LICENSE.txt rename to modern-js/module-tools/static/js/2970.43a165d0.js.LICENSE.txt diff --git a/modern-js/module-tools/static/js/async/4639.ac2c02df.js b/modern-js/module-tools/static/js/async/4639.a2a77f95.js similarity index 60% rename from modern-js/module-tools/static/js/async/4639.ac2c02df.js rename to modern-js/module-tools/static/js/async/4639.a2a77f95.js index 4842b05946..e8fe596b92 100644 --- a/modern-js/module-tools/static/js/async/4639.ac2c02df.js +++ b/modern-js/module-tools/static/js/async/4639.a2a77f95.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4639"],{4642:function(e,n,s){s.r(n),s.d(n,{default:function(){return c}});var i=s(9980),d=s(9580);function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",strong:"strong",ol:"ol",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879\uFF0C\u5B83\u5305\u542B\u4E86\u6784\u5EFA\u7684\u6240\u6709\u914D\u7F6E\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728\u5F00\u59CB\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u524D\uFF0C\u8BF7\u5148\u9605\u8BFB\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u5176\u4F5C\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product.html",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5BF9\u4E8E TypeScript \u9879\u76EE\uFF0C\u53EA\u9700\u8981\u5728 ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u4E2D\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"}),", Modern.js Module \u4F1A\u81EA\u52A8\u8BC6\u522B ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u91CC\u7684\u522B\u540D\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u989D\u5916\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"alias"})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: {\n '@common': './src/common',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4EE5\u4E0A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u5982\u679C\u5728\u4EE3\u7801\u4E2D\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"}),", \u5219\u4F1A\u6620\u5C04\u5230 ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," \u8DEF\u5F84\u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"alias"})," \u7684\u503C\u5B9A\u4E49\u4E3A\u51FD\u6570\u65F6\uFF0C\u53EF\u4EE5\u63A5\u53D7\u9884\u8BBE\u7684 alias \u5BF9\u8C61\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n alias['@common'] = './src/common';\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4E5F\u53EF\u4EE5\u5728\u51FD\u6570\u4E2D\u8FD4\u56DE\u4E00\u4E2A\u65B0\u5BF9\u8C61\u4F5C\u4E3A\u6700\u7EC8\u7ED3\u679C\uFF0C\u65B0\u5BF9\u8C61\u4F1A\u8986\u76D6\u9884\u8BBE\u7684 alias \u5BF9\u8C61\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n return {\n '@common': './src/common',\n };\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5305\u542B\u9759\u6001\u8D44\u6E90\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u6587\u4EF6\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53 asset.name \u4E3A string \u7C7B\u578B\u65F6\uFF0C\u4F1A\u81EA\u52A8\u5BF9 [name]\u3001[ext]\u3001[hash] \u8FDB\u884C\u66FF\u6362\uFF0C\u5206\u522B\u66FF\u6362\u4E3A\u6587\u4EF6\u540D\u3001\u62D3\u5C55\u540D\u3001\u6587\u4EF6 hash\u3002\n\u5982\u679C\u60F3\u8981\u66F4\u9AD8\u7684\u81EA\u7531\u5EA6\uFF0C\u53EF\u4EE5\u628A asset.name \u4F5C\u4E3A\u65B9\u6CD5\u4F7F\u7528\uFF0C\u8FD4\u56DE\u503C\u5373\u4E3A\u6587\u4EF6\u540D\u3002\u6B64\u65F6\uFF0C\u8BE5\u65B9\u6CD5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570 assetPath\uFF0C\u5BF9\u5E94\u8D44\u6E90\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u8BBE\u7F6E\u9759\u6001\u8D44\u6E90\u88AB\u81EA\u52A8\u5185\u8054\u4E3A base64 \u7684\u4F53\u79EF\u9608\u503C\u3002"}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u5728\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u9ED8\u8BA4\u4F1A\u5185\u8054\u4F53\u79EF\u5C0F\u4E8E 10KB \u7684\u56FE\u7247\u3001\u5B57\u4F53\u3001\u5A92\u4F53\u7B49\u8D44\u6E90\uFF0C\u5C06\u5B83\u4EEC\u901A\u8FC7 Base64 \u7F16\u7801\uFF0C\u5E76\u5185\u8054\u5230\u4EA7\u7269\u4E2D\uFF0C\u4E0D\u518D\u4F1A\u53D1\u9001\u72EC\u7ACB\u7684 HTTP \u8BF7\u6C42\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u4FEE\u6539 ",(0,i.jsx)(n.code,{children:"limit"})," \u53C2\u6570\u6765\u8C03\u6574\u8FD9\u4E2A\u9608\u503C\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06 ",(0,i.jsx)(n.code,{children:"limit"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"0"})," \u6765\u907F\u514D\u8D44\u6E90\u5185\u8054\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u8DEF\u5F84\uFF0C\u4F1A\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6253\u5305\u65F6\u7ED9\u672A\u5185\u8054\u8D44\u6E90\u7684 CDN \u524D\u7F00\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C\u6240\u6709\u9759\u6001\u8D44\u6E90\u90FD\u4F1A\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"https://xxx/"})," \u524D\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6253\u5305\u65F6\u5C06 SVG \u4F5C\u4E3A\u4E00\u4E2A React \u7EC4\u4EF6\u5904\u7406\uFF0Coptions \u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),"\uFF0C\u53E6\u5916\u8FD8\u652F\u6301\u4E86 ",(0,i.jsx)(n.code,{children:"include"})," \u548C ",(0,i.jsx)(n.code,{children:"exclude"})," \u4E24\u4E2A\u914D\u7F6E\u9879\uFF0C\u7528\u4E8E\u5339\u914D\u9700\u8981\u5904\u7406\u7684 SVG \u6587\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F svgr \u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\u7684\u65B9\u5F0F\u5C06 SVG \u5F53\u505A\u7EC4\u4EF6\u4F7F\u7528\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5F00\u542F\u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u65B0\u5EFA\u4E00\u4E2A\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\uFF0C\u5E76\u5728 ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\uFF0C\u4FEE\u6539\u4F7F\u7528 SVG \u7684\u7C7B\u578B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u4E0D\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u914D\u7F6E\u4F7F\u7528 SVGR \u65F6 SVG \u7684\u5BFC\u51FA\u5F62\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6B64\u9009\u9879\u8BBE\u7F6E\u4E3A 'named' \u65F6\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u8BED\u6CD5\u5BFC\u5165\u7EC4\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u547D\u540D\u5BFC\u51FA\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"ReactComponent"}),"\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"})," \u8FDB\u884C\u81EA\u5B9A\u4E49\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6839\u636E ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," \u548C ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"})," \u81EA\u52A8\u6DFB\u52A0\u4EA7\u7269\u91CC js \u6587\u4EF6\u548C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u7684\u540E\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u95ED\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".js"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.ts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F\u540E\uFF0C\u5F53 type \u4E3A ",(0,i.jsx)(n.code,{children:"module"})," \u65F6\uFF0Cnode \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u4F5C\u4E3A esm \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA cjs \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.cts"}),";\n\u53CD\u4E4B\uFF0C\u5982\u679C\u7F3A\u5C11 type \u5B57\u6BB5\u6216\u8005 type \u4E3A ",(0,i.jsx)(n.code,{children:"commonjs"})," \u65F6\uFF0C node \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u6587\u4EF6\u4F5C\u4E3A cjs \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA esm \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".mjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.mts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728 bundleless \u6A21\u5F0F\u4E0B\u4F7F\u7528\u65F6\uFF0C\u6211\u4EEC\u4F1A\u6709\u4E00\u6B65\u989D\u5916\u7684\u64CD\u4F5C\uFF0C\u90A3\u5C31\u662F\u5904\u7406\u6BCF\u4E2A\u6587\u4EF6\u91CC\u7684 import/export \u8BED\u53E5\u3002\u6211\u4EEC\u4F1A\u7ED9\u76F8\u5BF9\u8DEF\u5F84\u52A0\u4E0A js \u6587\u4EF6\u540E\u7F00\uFF0C\u53EF\u80FD\u662F ",(0,i.jsx)(n.code,{children:".mjs"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u8FD9\u53D6\u51B3\u4E8E\u4F60\u7684\u5305\u914D\u7F6E\uFF0C\u6B64\u884C\u4E3A\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"\u5173\u95ED\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6CE8\u610F ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," \u89C4\u5219\u4F1A\u7834\u574F\u6B64\u884C\u4E3A\uFF0C\u4F60\u9700\u8981\u7981\u7528\u6B64\u89C4\u5219\n\u5982\u679C\u4F60\u9700\u8981\u5728 bundleless \u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u8BF7\u8865\u9F50 ",(0,i.jsx)(n.code,{children:"index"}),"\uFF0C\u4F8B\u5982 utils \u662F\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C \u4F60\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u6539\u5199\u4E3A ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u81EA\u52A8\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'}),"\uFF0C\u4E0D\u4F1A\u5C06\u5176\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4EA7\u7269\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6211\u4EEC\u5E0C\u671B\u5173\u95ED\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406\u884C\u4E3A\u65F6\u5019\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5B9E\u73B0\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u6837\u5BF9\u4E8E ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u9762\u7684\u4F9D\u8D56\u90FD\u4F1A\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u53EA\u60F3\u8981\u5173\u95ED\u5176\u4E2D\u67D0\u4E2A\u4E0B\u9762\u7684\u4F9D\u8D56\u5904\u7406\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," \u7684\u5BF9\u8C61\u5F62\u5F0F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS , CSS \u548C DTS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\u4F60\u60F3\u4E3A JS \u548C CSS \u6587\u4EF6\u6DFB\u52A0\u7248\u6743\u4FE1\u606F:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6784\u5EFA\u7C7B\u578B\uFF0C",(0,i.jsx)(n.code,{children:"bundle"})," \u4F1A\u6253\u5305\u4F60\u7684\u4EE3\u7801\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u53EA\u505A\u4EE3\u7801\u7684\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5C06\u6587\u4EF6\u6216\u76EE\u5F55\u62F7\u8D1D\u5230\u6307\u5B9A\u4F4D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './src/assets', to: '' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": \u6307\u5B9A\u5E76\u884C\u6267\u884C\u591A\u5C11\u4E2A\u590D\u5236\u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": \u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})}),"\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\uFF0C\u6CE8\u5165\u5230\u4EE3\u7801\u4E2D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u7531\u4E8E ",(0,i.jsx)(n.code,{children:"define"})," \u529F\u80FD\u662F\u7531\u5168\u5C40\u6587\u672C\u66FF\u6362\u5B9E\u73B0\u7684\uFF0C\u6240\u4EE5\u9700\u8981\u4FDD\u8BC1\u5168\u5C40\u53D8\u91CF\u503C\u4E3A\u5B57\u7B26\u4E32\uFF0C\u66F4\u4E3A\u5B89\u5168\u7684\u505A\u6CD5\u662F\u5C06\u6BCF\u4E2A\u5168\u5C40\u53D8\u91CF\u7684\u503C\u8F6C\u5316\u4E3A\u5B57\u7B26\u4E32\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6846\u67B6\u5185\u90E8\u4F1A\u81EA\u52A8\u8FDB\u884C JSON \u5E8F\u5217\u5316\u5904\u7406\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u624B\u52A8\u6267\u884C\u5E8F\u5217\u5316\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u9700\u8981\u81EA\u52A8\u5E8F\u5217\u5316\uFF0C\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"/api/config/build-config.html#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," \u5B9A\u4E49 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," \u6765\u5B9E\u73B0\u3002\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0D\u8FC7\u8981\u6CE8\u610F\uFF1A\u5982\u679C\u9879\u76EE\u662F\u4E00\u4E2A TypeScript \u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u53EF\u80FD\u9700\u8981\u5728\u9879\u76EE\u6E90\u4EE3\u7801\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(n.code,{children:".d.ts"})," \u6587\u4EF6\u91CC\u589E\u52A0\u4EE5\u4E0B\u5185\u5BB9\uFF1A"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"d.ts"})," \u6587\u4EF6\uFF0C\u5219\u53EF\u4EE5\u624B\u52A8\u521B\u5EFA\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FDB\u884C\u73AF\u5883\u53D8\u91CF\u66FF\u6362\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u4E0A\u9762\u7684\u914D\u7F6E\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u5C06\u4E0B\u9762\u8FD9\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u524D\u4EE3\u7801\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"})," \u7684\u65F6\u5019\uFF0C\u8F6C\u6362\u4E3A\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u540E\u4EE3\u7801\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u4E3A\u4E86\u9632\u6B62\u5168\u5C40\u66FF\u6362\u66FF\u6362\u8FC7\u5EA6\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u65F6\u9075\u5FAA\u4EE5\u4E0B\u4E24\u4E2A\u539F\u5219\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5168\u5C40\u5E38\u91CF\u4F7F\u7528\u5927\u5199"}),"\n",(0,i.jsx)(n.li,{children:"\u81EA\u5B9A\u4E49\u5168\u5C40\u5E38\u91CF\u524D\u7F00\u540E\u7F00\uFF0C\u786E\u4FDD\u72EC\u4E00\u65E0\u4E8C"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u7684\u76F8\u5173\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4F1A\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u63A7\u5236\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\uFF0C\u662F\u5426\u5141\u8BB8\u6784\u5EFA\u6210\u529F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\u4F1A\u5BFC\u81F4\u6784\u5EFA\u5931\u8D25"}),"\u3002\u5C06 ",(0,i.jsx)(n.code,{children:"abortOnError"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u540E\uFF0C\u5373\u4F7F\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u7C7B\u578B\u95EE\u9898\uFF0C\u6784\u5EFA\u4F9D\u7136\u4F1A\u6210\u529F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5F53\u5173\u95ED\u8BE5\u914D\u7F6E\u540E\uFF0C\u65E0\u6CD5\u4FDD\u8BC1\u7C7B\u578B\u6587\u4EF6\u80FD\u6B63\u5E38\u751F\u6210\uFF0C\u4E14\u4E0D\u4FDD\u8BC1\u5185\u5BB9\u6B63\u786E\u3002\u5728 ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"})," \u65F6\uFF0C\u5373\u6253\u5305\u6A21\u5F0F\u4E0B\uFF0C\u7C7B\u578B\u6587\u4EF6\u4E00\u5B9A\u4E0D\u4F1A\u751F\u6210\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7C7B\u578B\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6BD4\u5982\u8F93\u51FA\u5230 ",(0,i.jsx)(n.code,{children:"outDir"})," \u4E0B\u9762\u7684 ",(0,i.jsx)(n.code,{children:"types"})," \u76EE\u5F55\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F tsc '--build' \u9009\u9879\u3002\u5F53\u4F7F\u7528 project reference \u65F6\uFF0C\n\u53EF\u4EE5\u4F7F\u7528 '--build' \u9009\u9879\u4EE5\u5B9E\u73B0\u9879\u76EE\u4E4B\u95F4\u7684\u534F\u540C\u5DE5\u4F5C\u4EE5\u52A0\u5FEB\u6784\u5EFA\u901F\u5EA6\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u9009\u9879\u8981\u6C42\u7248\u672C > 2.43.0\uFF0C\n\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 2.42.0 \u7248\u672C\u66FE\u8BD5\u9A8C\u6027\u5730\u5F00\u542F\u6B64\u9009\u9879\uFF0C\u4F46\u5176\u5E26\u6765\u7684\u8BB8\u591A\u95EE\u9898\u4F7F\u6211\u4EEC\u4E0D\u5F97\u4E0D\u52A8\u6001\u5F00\u542F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0C\u4E3A\u4E86\u6EE1\u8DB3\u6784\u5EFA\u9700\u6C42\uFF0C\u4F60\u5FC5\u987B\u663E\u5F0F\u5730\u5728 tsconfig.json \u91CC\u8BBE\u7F6E 'declarationDir' \u6216\u8005 'outDir'\uFF0C\n\u5982\u679C\u4F60\u7528\u7684\u4E0D\u662F TS >= 5.0 \u7248\u672C\uFF0C\u4F60\u8FD8\u9700\u8981\u663E\u5F0F\u5730\u8BBE\u7F6E 'declaration' \u548C 'emitDeclarationOnly'\u3002\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u662F\u5426\u5728\u6784\u5EFA\u65F6\u53EA\u751F\u6210\u7C7B\u578B\u6587\u4EF6\uFF0C\u4E0D\u751F\u6210 JavaScript \u4EA7\u7269\u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u65F6\uFF0C\u4E0D\u4F1A\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\uFF0C\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u65F6\uFF0C\u4F1A\u6839\u636E ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"})," \u6765\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6253\u5305\u4E09\u65B9\u7C7B\u578B\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u6784\u5EFA\u5DE5\u5177\u8FD8\u672A\u5BF9 export \u8FDB\u884C\u5206\u6790\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u7684\u4EFB\u4F55\u4E00\u4E2A\u4E09\u65B9\u5305\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u65F6\uFF0C\u90FD\u53EF\u80FD\u4F1A\u4E2D\u65AD\u5F53\u524D\u7684\u6784\u5EFA\u6D41\u7A0B\uFF0C\u8FD9\u4F1A\u5BFC\u81F4\u6784\u5EFA\u6D41\u7A0B\u4E0D\u53EF\u63A7\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u8FD9\u4E2A\u914D\u7F6E\u6765\u907F\u514D\u8BE5\u95EE\u9898\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u5E9F\u5F03"}),"\uFF0C\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," \u914D\u7F6E\u66FF\u4EE3\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u7528\u4E8E\u751F\u6210\u7C7B\u578B\u6587\u4EF6\u7684 tsconfig \u6587\u4EF6\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539\u5E95\u5C42\u7684 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u914D\u7F6E"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6211\u4EEC\u9700\u8981\u4FEE\u6539\u751F\u6210\u6587\u4EF6\u7684\u540E\u7F00\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6CE8\u518C\u4E00\u4E2A esbuild \u63D2\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u5728\u539F\u672C esbuild \u6784\u5EFA\u7684\u57FA\u7840\u4E0A\u505A\u4E86\u8BB8\u591A\u6269\u5C55\uFF0C\u56E0\u6B64\u4F7F\u7528\u6B64\u914D\u7F6E\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F18\u5148\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u914D\u7F6E\uFF0C\u4F8B\u5982 esbuild \u5E76\u4E0D\u652F\u6301 ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\uFF0C\u4F46\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 SWC \u652F\u6301\u4E86\u6B64\u573A\u666F\uFF0C\u6B64\u65F6\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"esbuildOptions"})," \u8BBE\u7F6E",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\u4F1A\u62A5\u9519\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u76EE\u524D\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"enhanced-resolve"})," \u66FF\u4EE3\u4E86 esbuild \u7684 resolve \u89E3\u6790\u7B97\u6CD5\uFF0C\u6240\u4EE5\u4FEE\u6539 esbuild resolve \u76F8\u5173\u914D\u7F6E\u65E0\u6548\uFF0C\u8BA1\u5212\u5728\u672A\u6765\u4F1A\u5207\u6362\u56DE\u6765\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u8F93\u51FA\u7684 JS \u4EE3\u7801\u53EF\u80FD\u4F1A\u4F9D\u8D56\u4E00\u4E9B\u8F85\u52A9\u51FD\u6570\u6765\u652F\u6301\u76EE\u6807\u73AF\u5883\u6216\u8005\u8F93\u51FA\u683C\u5F0F\uFF0C\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u4F1A\u88AB\u5185\u8054\u5728\u9700\u8981\u5B83\u7684\u6587\u4EF6\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\uFF0C\u5C06\u5185\u8054\u7684\u8F85\u52A9\u51FD\u6570\u8F6C\u6362\u4E3A\u4ECE\u5916\u90E8\u6A21\u5757 ",(0,i.jsx)(n.code,{children:"@swc/helpers"})," \u5BFC\u5165\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4F7F\u7528\u8BE5\u914D\u7F6E\u524D\u540E\u7684\u4EA7\u7269\u53D8\u5316\u6BD4\u8F83\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u524D\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u8F85\u52A9\u51FD\u6570\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// \u8F85\u52A9\u51FD\u6570\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u4ECE @swc/helpers \u5BFC\u5165\u7684\u8F85\u52A9\u51FD\u6570\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u5728\u6253\u5305\u65F6\u6392\u9664\u4E00\u4E9B\u5916\u90E8\u4F9D\u8D56\uFF0C\u907F\u514D\u5C06\u8FD9\u4E9B\u4F9D\u8D56\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Externals = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // \u907F\u514D\u6253\u5305 React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u540C ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," \u914D\u7F6E\uFF0C\u7528\u4E8E\u5728\u8F93\u51FA\u6587\u4EF6\u672B\u5C3E\u6DFB\u52A0\u6CE8\u91CA\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u8BBE\u7F6E JavaScript \u4EA7\u7269\u8F93\u51FA\u7684\u683C\u5F0F\uFF0C\u5176\u4E2D ",(0,i.jsx)(n.code,{children:"iife"})," \u548C ",(0,i.jsx)(n.code,{children:"umd"})," \u53EA\u5728 ",(0,i.jsx)(n.code,{children:"buildType"})," \u4E3A ",(0,i.jsx)(n.code,{children:"bundle"})," \u65F6\u751F\u6548\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'esm \u4EE3\u8868 "ECMAScript \u6A21\u5757"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 import \u548C export \u8BED\u6CD5\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'cjs \u4EE3\u8868 "CommonJS"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 exports\u3001require \u548C module \u8BED\u6CD5\uFF0C\u901A\u5E38\u4E3A Node.js \u73AF\u5883\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'iife \u4EE3\u8868 "\u7ACB\u5373\u8C03\u7528\u51FD\u6570\u8868\u8FBE\u5F0F"\uFF0C\u5B83\u5C06\u4EE3\u7801\u5305\u88F9\u5728\u51FD\u6570\u8868\u8FBE\u5F0F\u4E2D\uFF0C\u786E\u4FDD\u4EE3\u7801\u4E2D\u7684\u4EFB\u4F55\u53D8\u91CF\u4E0D\u4F1A\u610F\u5916\u5730\u4E0E\u5168\u5C40\u8303\u56F4\u4E2D\u7684\u53D8\u91CF\u51B2\u7A81\uFF0C\u901A\u5E38\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u8FD0\u884C\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'umd \u4EE3\u8868 "Universal Module Definition"\uFF0C\u7528\u4E8E\u5728\u4E0D\u540C\u73AF\u5883\uFF08\u6D4F\u89C8\u5668\u3001Node.js \u7B49\uFF09\u4E2D\u8FD0\u884C\u3002umd \u683C\u5F0F\u7684\u6A21\u5757\u53EF\u4EE5\u5728\u591A\u79CD\u73AF\u5883\u4E0B\u4F7F\u7528\uFF0C\u65E2\u53EF\u4EE5\u4F5C\u4E3A\u5168\u5C40\u53D8\u91CF\u8BBF\u95EE\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7\u6A21\u5757\u52A0\u8F7D\u5668\uFF08\u5982 RequireJS\uFF09\u8FDB\u884C\u6A21\u5757\u5316\u52A0\u8F7D\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5EFA\u751F\u547D\u5468\u671F\u94A9\u5B50,\u5141\u8BB8\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u7279\u5B9A\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u5728 apply \u65B9\u6CD5\u91CC\u62FF\u5230 compiler \u5B9E\u4F8B\uFF0C\u4FEE\u6539\u5176\u5C5E\u6027\uFF0C\u4EE5\u53CA\u5728\u4E0D\u540C\u9636\u6BB5\u6267\u884C\u81EA\u5B9A\u4E49\u903B\u8F91\uFF0C\u5BF9\u4E8E Hook \u7684\u8BE6\u7EC6\u4ECB\u7ECD\uFF0C\n\u53C2\u8003",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html#%E4%BD%BF%E7%94%A8-hook-%E4%BB%8B%E5%85%A5%E6%9E%84%E5%BB%BA%E6%B5%81%E7%A8%8B",children:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B"}),"\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u6570\u7EC4\u5F62\u5F0F\u53EF\u4EE5\u6307\u5B9A\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u6570\u7EC4\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u4EE5 ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u548C ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," \u4E3A\u5165\u53E3\u5206\u522B\u8FDB\u884C\u6784\u5EFA\u3002",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0D\u652F\u6301\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"input"})," \u4E3A\u76EE\u5F55\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u540C\u65F6\u5904\u7406 ",(0,i.jsx)(n.code,{children:"src/a"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u6570\u7EC4\u6A21\u5F0F\u8FD8\u652F\u6301\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"!"})," \u6765\u8FC7\u6EE4\u90E8\u5206\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0A\u9762\u7684\u914D\u7F6E\u5C06\u6253\u5305 ",(0,i.jsx)(n.code,{children:"src"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\uFF0C\u540C\u65F6\u4F1A\u8FC7\u6EE4\u4EE5 ",(0,i.jsx)(n.code,{children:"spec.ts"})," \u4E3A\u540E\u7F00\u7684\u6587\u4EF6\u3002\u8FD9\u5728\u6D4B\u8BD5\u6587\u4EF6\u4E0E\u6E90\u7801\u6587\u4EF6\u5728\u540C\u4E00\u4E2A\u6839\u76EE\u5F55\u4E0B\u7684\u60C5\u51B5\u4F1A\u5F88\u6709\u7528\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5728 bundle \u6A21\u5F0F\u4E0B\u9700\u8981\u4FEE\u6539\u4EA7\u7269\u7684\u8F93\u51FA\u6587\u4EF6\u540D\u79F0\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5BF9\u8C61\u5F62\u5F0F\u8FDB\u884C\u914D\u7F6E\u3002"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7684 Key \u662F\u4EA7\u7269\u7684\u6587\u4EF6\u540D\u79F0\uFF0CValue \u662F\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A JSX \u7684\u7F16\u8BD1\u65B9\u5F0F\uFF0C\u9ED8\u8BA4\u652F\u6301 React 17 \u53CA\u66F4\u9AD8\u7248\u672C\uFF0C\u81EA\u52A8\u6CE8\u5165 JSX \u8FD0\u884C\u65F6\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"automatic | transform | preserve"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u652F\u6301 React 16\uFF0C\u5219\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"transform"}),"\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u4E0D\u9700\u8981\u8F6C\u6362 JSX ,\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"preserve"}),", \u4F46\u6B64\u65F6\u8BF7\u4E0D\u8981",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-swc",children:"\u4F7F\u7528 swc"})," \u505A\u4EE3\u7801\u8F6C\u6362\u3002\n\u5173\u4E8E JSX Transform \u7684\u66F4\u591A\u8BF4\u660E\uFF0C\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u94FE\u63A5\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8FD9\u4E2A\u9009\u9879\u7528\u4E8E\u6784\u5EFA\u5206\u6790\uFF0C\u5F00\u542F\u8BE5\u9009\u9879\u540E\uFF0Cesbuild \u4F1A\u4EE5 JSON \u683C\u5F0F\u751F\u6210\u6709\u5173\u6784\u5EFA\u7684\u4E00\u4E9B\u5143\u6570\u636E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"metafile"})," \u751F\u6210\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C build \u6784\u5EFA\u540E\uFF0C\u4EA7\u7269\u76EE\u5F55\u4E0B\u4F1A\u751F\u6210 ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," \u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," \u548C ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," \u7B49\u5DE5\u5177\u8FDB\u884C\u53EF\u89C6\u5316\u5206\u6790\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528 esbuild \u6216\u8005 terser \u538B\u7F29\u4EE3\u7801\uFF0C\u4E5F\u53EF\u4EE5\u4F20\u5165 ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u8F93\u51FA\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u751F\u6210\u7528\u4E8E Node.js \u73AF\u5883\u4E0B\u7684\u4EE3\u7801\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6307\u5B9A\u4E3A ",(0,i.jsx)(n.code,{children:"browser"}),"\uFF0C\u4F1A\u751F\u6210\u7528\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u7684\u4EE3\u7801\u3002\n\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," \u6784\u5EFA\u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u5BF9\u5F15\u7528\u8DEF\u5F84\u8FDB\u884C\u91CD\u5B9A\u5411\uFF0C\u786E\u4FDD\u6307\u5411\u4E86\u6B63\u786E\u7684\u4EA7\u7269\uFF0C\u4F8B\u5982\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import './index.less'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import './index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from './close.svg'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import icon from '../asset/close.svg'"}),"\uFF08\u4F9D\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A\uFF09"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (\u5982\u679C\u751F\u6210\u4E86 utils.mjs\uFF0C\u89C6\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u573A\u666F\u4E0B\uFF0C\u4F60\u53EF\u80FD\u4E0D\u9700\u8981\u8FD9\u4E9B\u529F\u80FD\uFF0C\u90A3\u4E48\u53EF\u4EE5\u901A\u8FC7\u6B64\u914D\u7F6E\u5173\u95ED\u5B83\uFF0C\u5173\u95ED\u540E\uFF0C\u5176\u5F15\u7528\u8DEF\u5F84\u5C06\u4E0D\u4F1A\u53D1\u751F\u6539\u53D8\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // \u5173\u95ED\u5BF9\u522B\u540D\u8DEF\u5F84\u7684\u4FEE\u6539\n style: false, // \u5173\u95ED\u5BF9\u6837\u5F0F\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n asset: false, // \u5173\u95ED\u5BF9\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n autoExtension: false, // \u5173\u95ED\u5BF9 js \u6587\u4EF6\u540E\u7F00\u7684\u4FEE\u6539\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u81EA\u5B9A\u4E49\u6A21\u5757\u89E3\u6790\u9009\u9879"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvealias",children:["resolve.alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvealias",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u57FA\u672C\u7528\u6CD5\u548C ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u4E00\u81F4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u7684\u95EE\u9898\u5728\u4E8E\u6211\u4EEC\u5728 bundleless \u573A\u666F\u4E0B\u9519\u8BEF\u7684\u5904\u7406\u4E86 Module ID \u7684\u60C5\u51B5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "react";\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u914D\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"alias: { react: 'react-native' }"})," \u540E\uFF0C\u7ED3\u679C\u4F1A\u53D8\u6210"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "./react-native";\n'})}),"\n",(0,i.jsx)(n.p,{children:"\u4E00\u4E2A Module ID \u88AB\u9519\u8BEF\u7684\u5904\u7406\u6210\u4E86\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u663E\u7136\u8FD9\u662F\u4E0D\u7B26\u5408\u9884\u671F\u7684\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u60F3\u8981\u4FEE\u590D\u8FD9\u4E2A\u95EE\u9898\uFF0C\u4F46\u662F\u8FD9\u53EF\u80FD\u4F1A\u7834\u574F\u5DF2\u6709\u7684\u9879\u76EE\uFF0C\u56E0\u6B64\u6211\u4EEC\u5728 2.58.0 \u7248\u672C\u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u6765\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\u3002\n\u5E76\u4E14 ",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u91CC\u79FB\u9664\u4E86 ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u63D0\u4F9B\u7684\u9ED8\u8BA4\u503C ",(0,i.jsx)(n.code,{children:'{ "@": "./src"}'})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u6B64\u529F\u80FD\uFF0C\u8BF7\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"resolve.alias"}),", \u6CE8\u610F\u4E0D\u8981\u4E0E ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u6DF7\u7528\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4E0B\u4E00\u4E2A\u5927\u7248\u672C\uFF0C",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u5C06\u4F1A\u53D6\u4EE3 ",(0,i.jsx)(n.code,{children:"alias"})," \u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"package.json \u4E2D\uFF0C\u5728\u89E3\u6790\u5305\u7684\u5165\u53E3\u70B9\u65F6\u5C1D\u8BD5\u7684\u5B57\u6BB5\u5217\u8868\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A\u53D6\u51B3\u4E8E",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u6211\u4EEC\u60F3\u8981\u5148\u52A0\u8F7D ",(0,i.jsx)(n.code,{children:"js:source"})," \u5B57\u6BB5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u6BD4 package.json \u4E2D exports \u5B57\u6BB5\u7684\u4F18\u5148\u7EA7\u4F4E\uFF0C\u5982\u679C\u4E00\u4E2A\u5165\u53E3\u70B9\u4ECE exports \u6210\u529F\u89E3\u6790\uFF0C",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u5C06\u88AB\u5FFD\u7565\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u652F\u6301\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E css \u6587\u4EF6\uFF0C\u8BF7\u4E0D\u8981\u4F7F\u7528\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u76EE\u524D Module \u4EC5\u652F\u6301 ['.less', '.css', '.sass', '.scss'] \u540E\u7F00\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["Node \u7684\u89E3\u6790\u7B97\u6CD5\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:".mjs"})," \u548C ",(0,i.jsx)(n.code,{children:"cjs"})," \u89C6\u4E3A\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u56E0\u6B64\u8FD9\u91CC\u9ED8\u8BA4\u4E5F\u4E0D\u4F1A\uFF0C\u4F46\u662F\u53EF\u4EE5\u901A\u8FC7\u66F4\u6539\u6B64\u914D\u7F6E\u6765\u5305\u542B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u6784\u5EFA cjs / esm \u4EA7\u7269\u65F6\u6CE8\u5165\u4E00\u4E9B\u57AB\u7247\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u53EA\u80FD\u5728 commonjs \u91CC\u4F7F\u7528\uFF0C\u5F00\u542F\u6B64\u9009\u9879\u540E\uFF0C\u5F53\u4EA7\u7269\u683C\u5F0F\u4E3A esm \u65F6\uFF0C\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u7F16\u8BD1\u4E3A ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u4EE3\u7801\u89C1 ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"shims"}),"\uFF0C\n\u9700\u8981\u6CE8\u610F\u7684\u662F esm shims \u53EA\u4F1A\u5728 ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," \u4E3A node \u65F6\u6CE8\u5165\uFF0C\u56E0\u4E3A\u7528\u5230\u4E86 url \u6A21\u5757\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u901A\u8FC7 package.json \u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u6765\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4E09\u65B9\u5305\u7684 package.json \u662F\u4E0D\u53EF\u9760\u7684\u3002\n\u4F8B\u5982\u6211\u4EEC\u5F15\u7528\u4E86\u4E00\u4E2A\u4E09\u65B9\u5305\u7684\u6837\u5F0F\u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F46\u662F\u8FD9\u4E2A\u4E09\u65B9\u5305\u7684 package.json \u91CC\u5E76\u6CA1\u6709\u5C06\u6837\u5F0F\u6587\u4EF6\u914D\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u91CC\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u540C\u65F6\u4F60\u53C8\u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," \u4E3A ",(0,i.jsx)(n.code,{children:"true"}),"\uFF0C\u5728\u63A7\u5236\u53F0\u53EF\u4EE5\u770B\u5230\u7C7B\u4F3C\u7684\u8B66\u544A\u4FE1\u606F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u65F6\u5019\u5C31\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u914D\u7F6E\u9879\uFF0C\u624B\u52A8\u914D\u7F6E\u6A21\u5757\u7684",(0,i.jsx)(n.code,{children:'"sideEffects"'}),"\uFF0C\u914D\u7F6E\u652F\u6301\u6B63\u5219\u548C\u51FD\u6570\u5F62\u5F0F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6DFB\u52A0\u6B64\u914D\u7F6E\u540E\uFF0C\u6253\u5305\u65F6\u5C06\u4E0D\u4F1A\u518D\u8BFB\u53D6 package.json \u91CC\u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6307\u5B9A\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55,\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"src"}),"\uFF0C\u7528\u4E8E\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6784\u5EFA\u65F6\u57FA\u4E8E\u6E90\u7801\u76EE\u5F55\u7ED3\u6784\u751F\u6210\u5BF9\u5E94\u7684\u4EA7\u7269\u76EE\u5F55\u3002\n\u7B49\u540C\u4E8E",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63A7\u5236 sourceMap \u5982\u4F55\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u5DF2\u5E9F\u5F03\uFF0C\u6B64\u914D\u7F6E\u4E0D\u4F1A\u4EA7\u751F\u4EFB\u4F55\u5F71\u54CD\u3002"})})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u6E90\u7801\u7684\u683C\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u5C06\u6E90\u7801\u4F5C\u4E3A EsModule \u8FDB\u884C\u5904\u7406\u3002\u5F53\u6E90\u7801\u4F7F\u7528\u7684\u662F CommonJS \u7684\u65F6\u5019\uFF0C\u9700\u8981\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"commonjs"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u5F00\u542F\u4EE3\u7801\u5206\u5272\u3002\n\u4EC5\u652F\u6301 ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," \u548C ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),"\uFF0C\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6837\u5F0F\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Less"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Less"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"4.1.3"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sass",children:["sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Sass \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Sass"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Sass"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"1.5.4"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u914D\u7F6E PostCSS \u7684\u9009\u9879\uFF0C\u4F20\u5165\u7684\u503C\u4F1A\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002\u6CE8\u610F ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u662F\u6D45\u62F7\u8D1D\uFF0C\u56E0\u6B64\u4F1A\u5B8C\u5168\u8986\u76D6\u5185\u7F6E\u7684 plugins \u6570\u7EC4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u8BF7\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // \u4EE5\u4E0B\u63D2\u4EF6\u9ED8\u8BA4\u542F\u7528\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // \u4EE5\u4E0B\u63D2\u4EF6\u4EC5\u5728 target \u4E3A `es5` \u65F6\u542F\u7528\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6253\u5305\u6A21\u5F0F\u4E0B\u662F\u5426\u5C06 CSS \u6837\u5F0F\u63D2\u5165\u5230 JavaScript \u4EE3\u7801\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5C06 ",(0,i.jsx)(n.code,{children:"inject"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u6765\u5F00\u542F\u6B64\u529F\u80FD\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230\u6E90\u7801\u4E2D\u5F15\u7528\u7684 CSS \u4EE3\u7801\u88AB\u5305\u542B\u5728\u4E86\u6253\u5305\u540E\u7684 JS \u4EA7\u7269\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u4F60\u5728\u6E90\u7801\u91CC\u5199\u4E86 ",(0,i.jsx)(n.code,{children:"import './index.scss'"}),"\uFF0C\u90A3\u4E48\u5728\u4EA7\u7269\u4E2D\u4F60\u4F1A\u770B\u5230\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"inject"})," \u540E\uFF0C\u4F60\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["CSS \u6587\u4EF6\u4E2D\u7684 ",(0,i.jsx)(n.code,{children:"@import"})," \u4E0D\u4F1A\u88AB\u5904\u7406\u3002\u5982\u679C\u4F60\u7684 CSS \u6587\u4EF6\u4E2D\u6709 ",(0,i.jsx)(n.code,{children:"@import"})," \uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5728 JS \u6587\u4EF6\u4E2D\u624B\u52A8\u5F15\u5165 CSS \u6587\u4EF6\uFF08less,scss \u6587\u4EF6\u4E0D\u9700\u8981\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u4F1A\u6709\u9884\u5904\u7406\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u9700\u8981\u8003\u8651 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u7684\u5F71\u54CD\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u7684\u6784\u5EFA\u5668\u4F1A\u8BA4\u4E3A CSS \u662F\u6709\u526F\u4F5C\u7528\u7684\uFF0C\u5982\u679C\u4F60\u7684\u9879\u76EE\u4E2D\u6216\u8005\u4E09\u65B9\u5305\u7684 package.json \u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u5B57\u6BB5\u5E76\u4E14\u6CA1\u6709\u5305\u542B\u6B64 CSS \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u5C06\u4F1A\u5F97\u5230\u4E00\u4E2A\u8B66\u544A\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"})," \u6765\u89E3\u51B3\u3002"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6839\u636E\u6587\u4EF6\u540D\u81EA\u52A8\u542F\u7528 CSS Modules\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : \u4E3A\u4EE5 ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," \u6587\u4EF6\u540D\u7ED3\u5C3E\u7684\u6837\u5F0F\u6587\u4EF6\u542F\u7528 CSS Modules\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : \u7981\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : \u4E3A\u5339\u914D\u6B63\u5219\u6761\u4EF6\u7684\u6240\u6709\u6587\u4EF6\u542F\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules \u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4E00\u4E2A\u5E38\u7528\u7684\u914D\u7F6E\u662F ",(0,i.jsx)(n.code,{children:"localsConvention"}),"\uFF0C\u5B83\u53EF\u4EE5\u6539\u53D8 CSS Modules \u7684\u7C7B\u540D\u751F\u6210\u89C4\u5219\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E\u4EE5\u4E0B\u6837\u5F0F\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," \u6765\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u4E4B\u524D\uFF0C\u4F60\u9700\u8981\u542F\u7528 Modern.js Module \u7684 Tailwind CSS \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BF7\u9605\u8BFB",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss.html",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u7AE0\u8282\u6765\u4E86\u89E3\u5F00\u542F\u65B9\u5F0F\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u7C7B\u578B",children:["\u7C7B\u578B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u51FD\u6570\u8FD4\u56DE\u7684\u5BF9\u8C61\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u7684\u4F7F\u7528\u65B9\u5F0F\u548C Tailwind CSS \u4E00\u81F4: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"\u5FEB\u901F\u4F20\u9001\u95E8"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E\u9879\uFF0C\u90A3\u4E48 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u5C06\u4F1A\u88AB ",(0,i.jsx)(n.code,{children:"designSystem"})," \u7684\u503C\u6240\u8986\u76D6\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u914D\u7F6E\u7684\u4F7F\u7528\u65B9\u5F0F\u4E0E Tailwind CSS \u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," \u7528\u4E8E\u4E3A\u751F\u6210\u7684 JavaScript \u4EE3\u7801\u8BBE\u7F6E\u76EE\u6807\u73AF\u5883\u3002\u5B83\u8BA9 Modern.js Module \u5C06\u76EE\u6807\u73AF\u5883\u65E0\u6CD5\u8BC6\u522B\u7684 JavaScript \u8BED\u6CD5\u8F6C\u6362\u4E3A\u5728\u8FD9\u4E9B\u73AF\u5883\u4E2D\u53EF\u7528\u7684\u4F4E\u7248\u672C JavaScript \u8BED\u6CD5\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06\u4EE3\u7801\u7F16\u8BD1\u5230 ",(0,i.jsx)(n.code,{children:"es5"})," \u8BED\u6CD5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E0E babel-plugin-import \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E SWC \u5B9E\u73B0\uFF0C\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u53C2\u8003",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9",children:"\u300CImport \u63D2\u4EF6\u2014\u2014\u6CE8\u610F\u4E8B\u9879\u300D"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u6A21\u5757\u5316 ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," \u7684\u5BFC\u5165\uFF0C\u5220\u9664\u672A\u4F7F\u7528\u7684 lodash \u6A21\u5757\uFF0C\u4ECE\u800C\u51CF\u5C11 lodash \u4EE3\u7801\u4F53\u79EF\u3002\u8FD9\u9879\u4F18\u5316\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," \u548C ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," \u5B9E\u73B0\u3002\n\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0CModern.js Module \u4F1A\u81EA\u52A8\u5C06 lodash \u7684\u4EE3\u7801\u5F15\u7528\u6307\u5411\u5B50\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6BD4\u5982\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8F6C\u6362\u540E\u7684\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"TypeScript \u914D\u7F6E\u6587\u4EF6\u7684\u8DEF\u5F84\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"react"})," \u548C ",(0,i.jsx)(n.code,{children:"react-dom"})," \u4F1A\u88AB\u770B\u505A\u662F\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF0C\u4E0D\u4F1A\u88AB\u6253\u5305\u8FDB UMD \u4EA7\u7269\u4E2D\uFF0C\u800C\u662F\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.React"})," \u548C ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})," \u7684\u65B9\u5F0F\u8FDB\u884C\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6 UMD \u4EA7\u7269\u4F1A\u53BB\u6302\u8F7D\u5230 ",(0,i.jsx)(n.code,{children:"global.myLib"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9700\u8981\u9075\u5B88 UMD \u89C4\u8303\uFF0CUMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u4E0D\u80FD\u548C\u5168\u5C40\u53D8\u91CF\u540D\u51B2\u7A81\u3002"}),"\n",(0,i.jsxs)(n.li,{children:["\u6A21\u5757\u540D\u4F1A\u88AB\u8F6C\u6362\u4E3A\u9A7C\u5CF0\u547D\u540D\uFF0C\u5982 ",(0,i.jsx)(n.code,{children:"my-lib"})," \u4F1A\u88AB\u8F6C\u6362\u4E3A ",(0,i.jsx)(n.code,{children:"myLib"}),"\uFF0C\u53EF\u53C2\u8003",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsx)(n.p,{children:"\u540C\u65F6\u51FD\u6570\u5F62\u5F0F\u53EF\u4EE5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570\uFF0C\u4E3A\u5F53\u524D\u6253\u5305\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n});\n```import { aliases } from '../../../../../../toolkit/utils/dist/compiled/browserslist';\nimport { createElement } from 'react';\n\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}let c=l;l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.alias",id:"resolvealias",depth:3},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"sass",id:"sass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["4639"],{4642:function(e,n,s){s.r(n),s.d(n,{default:function(){return c}});var i=s(9980),d=s(9580);function r(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",strong:"strong",ol:"ol",h3:"h3"},(0,d.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," \u662F\u4E00\u4E2A\u7528\u6765\u63CF\u8FF0\u5982\u4F55\u7F16\u8BD1\u3001\u751F\u6210\u6784\u5EFA\u4EA7\u7269\u7684\u914D\u7F6E\u9879\uFF0C\u5B83\u5305\u542B\u4E86\u6784\u5EFA\u7684\u6240\u6709\u914D\u7F6E\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728\u5F00\u59CB\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"buildConfig"})," \u4E4B\u524D\uFF0C\u8BF7\u5148\u9605\u8BFB\u4EE5\u4E0B\u6587\u6863\u6765\u4E86\u89E3\u5176\u4F5C\u7528\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product.html",children:"\u4FEE\u6539\u8F93\u51FA\u4EA7\u7269"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html",children:"\u6DF1\u5165\u7406\u89E3\u6784\u5EFA"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5BF9\u4E8E TypeScript \u9879\u76EE\uFF0C\u53EA\u9700\u8981\u5728 ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u4E2D\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"}),", Modern.js Module \u4F1A\u81EA\u52A8\u8BC6\u522B ",(0,i.jsx)(n.code,{children:"tsconfig.json"})," \u91CC\u7684\u522B\u540D\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u989D\u5916\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"alias"})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: {\n '@common': './src/common',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4EE5\u4E0A\u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u5982\u679C\u5728\u4EE3\u7801\u4E2D\u5F15\u7528 ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"}),", \u5219\u4F1A\u6620\u5C04\u5230 ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," \u8DEF\u5F84\u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"alias"})," \u7684\u503C\u5B9A\u4E49\u4E3A\u51FD\u6570\u65F6\uFF0C\u53EF\u4EE5\u63A5\u53D7\u9884\u8BBE\u7684 alias \u5BF9\u8C61\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u4FEE\u6539\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n alias['@common'] = './src/common';\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4E5F\u53EF\u4EE5\u5728\u51FD\u6570\u4E2D\u8FD4\u56DE\u4E00\u4E2A\u65B0\u5BF9\u8C61\u4F5C\u4E3A\u6700\u7EC8\u7ED3\u679C\uFF0C\u65B0\u5BF9\u8C61\u4F1A\u8986\u76D6\u9884\u8BBE\u7684 alias \u5BF9\u8C61\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n alias: alias => {\n return {\n '@common': './src/common',\n };\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5305\u542B\u9759\u6001\u8D44\u6E90\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u6587\u4EF6\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53 asset.name \u4E3A string \u7C7B\u578B\u65F6\uFF0C\u4F1A\u81EA\u52A8\u5BF9 [name]\u3001[ext]\u3001[hash] \u8FDB\u884C\u66FF\u6362\uFF0C\u5206\u522B\u66FF\u6362\u4E3A\u6587\u4EF6\u540D\u3001\u62D3\u5C55\u540D\u3001\u6587\u4EF6 hash\u3002\n\u5982\u679C\u60F3\u8981\u66F4\u9AD8\u7684\u81EA\u7531\u5EA6\uFF0C\u53EF\u4EE5\u628A asset.name \u4F5C\u4E3A\u65B9\u6CD5\u4F7F\u7528\uFF0C\u8FD4\u56DE\u503C\u5373\u4E3A\u6587\u4EF6\u540D\u3002\u6B64\u65F6\uFF0C\u8BE5\u65B9\u6CD5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570 assetPath\uFF0C\u5BF9\u5E94\u8D44\u6E90\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u8BBE\u7F6E\u9759\u6001\u8D44\u6E90\u88AB\u81EA\u52A8\u5185\u8054\u4E3A base64 \u7684\u4F53\u79EF\u9608\u503C\u3002"}),"\n",(0,i.jsx)(n.p,{children:"Modern.js Module \u5728\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u9ED8\u8BA4\u4F1A\u5185\u8054\u4F53\u79EF\u5C0F\u4E8E 10KB \u7684\u56FE\u7247\u3001\u5B57\u4F53\u3001\u5A92\u4F53\u7B49\u8D44\u6E90\uFF0C\u5C06\u5B83\u4EEC\u901A\u8FC7 Base64 \u7F16\u7801\uFF0C\u5E76\u5185\u8054\u5230\u4EA7\u7269\u4E2D\uFF0C\u4E0D\u518D\u4F1A\u53D1\u9001\u72EC\u7ACB\u7684 HTTP \u8BF7\u6C42\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u901A\u8FC7\u4FEE\u6539 ",(0,i.jsx)(n.code,{children:"limit"})," \u53C2\u6570\u6765\u8C03\u6574\u8FD9\u4E2A\u9608\u503C\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06 ",(0,i.jsx)(n.code,{children:"limit"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"0"})," \u6765\u907F\u514D\u8D44\u6E90\u5185\u8054\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9759\u6001\u8D44\u6E90\u8F93\u51FA\u8DEF\u5F84\uFF0C\u4F1A\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6253\u5305\u65F6\u7ED9\u672A\u5185\u8054\u8D44\u6E90\u7684 CDN \u524D\u7F00\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C\u6240\u6709\u9759\u6001\u8D44\u6E90\u90FD\u4F1A\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"https://xxx/"})," \u524D\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6253\u5305\u65F6\u5C06 SVG \u4F5C\u4E3A\u4E00\u4E2A React \u7EC4\u4EF6\u5904\u7406\uFF0Coptions \u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),"\uFF0C\u53E6\u5916\u8FD8\u652F\u6301\u4E86 ",(0,i.jsx)(n.code,{children:"include"})," \u548C ",(0,i.jsx)(n.code,{children:"exclude"})," \u4E24\u4E2A\u914D\u7F6E\u9879\uFF0C\u7528\u4E8E\u5339\u914D\u9700\u8981\u5904\u7406\u7684 SVG \u6587\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F svgr \u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u5BFC\u51FA\u7684\u65B9\u5F0F\u5C06 SVG \u5F53\u505A\u7EC4\u4EF6\u4F7F\u7528\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u5F00\u542F\u529F\u80FD\u540E\uFF0C\u53EF\u4EE5\u65B0\u5EFA\u4E00\u4E2A\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\uFF0C\u5E76\u5728 ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"})," \u6587\u4EF6\u4E2D\u589E\u52A0\uFF0C\u4FEE\u6539\u4F7F\u7528 SVG \u7684\u7C7B\u578B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8BBE\u5B9A\u4E0D\u5339\u914D\u7684 SVG \u6587\u4EF6"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u914D\u7F6E\u4F7F\u7528 SVGR \u65F6 SVG \u7684\u5BFC\u51FA\u5F62\u5F0F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6B64\u9009\u9879\u8BBE\u7F6E\u4E3A 'named' \u65F6\uFF0C\u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u8BED\u6CD5\u5BFC\u5165\u7EC4\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u547D\u540D\u5BFC\u51FA\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"ReactComponent"}),"\uFF0C\u5E76\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"})," \u8FDB\u884C\u81EA\u5B9A\u4E49\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6839\u636E ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," \u548C ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"})," \u81EA\u52A8\u6DFB\u52A0\u4EA7\u7269\u91CC js \u6587\u4EF6\u548C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u7684\u540E\u7F00\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5173\u95ED\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".js"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.ts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F\u540E\uFF0C\u5F53 type \u4E3A ",(0,i.jsx)(n.code,{children:"module"})," \u65F6\uFF0Cnode \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u4F5C\u4E3A esm \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA cjs \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.cts"}),";\n\u53CD\u4E4B\uFF0C\u5982\u679C\u7F3A\u5C11 type \u5B57\u6BB5\u6216\u8005 type \u4E3A ",(0,i.jsx)(n.code,{children:"commonjs"})," \u65F6\uFF0C node \u9ED8\u8BA4\u5C06 ",(0,i.jsx)(n.code,{children:".js"})," \u6587\u4EF6\u4F5C\u4E3A cjs \u52A0\u8F7D\uFF0C\u56E0\u6B64\u5F53\u6211\u4EEC\u8981\u8F93\u51FA esm \u4EA7\u7269\u65F6\uFF0Cjs \u4EA7\u7269\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:".mjs"}),"\uFF0C\u7C7B\u578B\u63CF\u8FF0\u6587\u4EF6\u540E\u7F00\u4E3A ",(0,i.jsx)(n.code,{children:"d.mts"}),"\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5728 bundleless \u6A21\u5F0F\u4E0B\u4F7F\u7528\u65F6\uFF0C\u6211\u4EEC\u4F1A\u6709\u4E00\u6B65\u989D\u5916\u7684\u64CD\u4F5C\uFF0C\u90A3\u5C31\u662F\u5904\u7406\u6BCF\u4E2A\u6587\u4EF6\u91CC\u7684 import/export \u8BED\u53E5\u3002\u6211\u4EEC\u4F1A\u7ED9\u76F8\u5BF9\u8DEF\u5F84\u52A0\u4E0A js \u6587\u4EF6\u540E\u7F00\uFF0C\u53EF\u80FD\u662F ",(0,i.jsx)(n.code,{children:".mjs"})," \u6216\u8005 ",(0,i.jsx)(n.code,{children:".cjs"}),"\uFF0C\u8FD9\u53D6\u51B3\u4E8E\u4F60\u7684\u5305\u914D\u7F6E\uFF0C\u6B64\u884C\u4E3A\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"\u5173\u95ED\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6CE8\u610F ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," \u89C4\u5219\u4F1A\u7834\u574F\u6B64\u884C\u4E3A\uFF0C\u4F60\u9700\u8981\u7981\u7528\u6B64\u89C4\u5219\n\u5982\u679C\u4F60\u9700\u8981\u5728 bundleless \u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u8BF7\u8865\u9F50 ",(0,i.jsx)(n.code,{children:"index"}),"\uFF0C\u4F8B\u5982 utils \u662F\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C \u4F60\u9700\u8981\u5C06 ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u6539\u5199\u4E3A ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u81EA\u52A8\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'}),"\uFF0C\u4E0D\u4F1A\u5C06\u5176\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4EA7\u7269\u4E2D\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u6211\u4EEC\u5E0C\u671B\u5173\u95ED\u5BF9\u4E8E\u7B2C\u4E09\u65B9\u4F9D\u8D56\u7684\u9ED8\u8BA4\u5904\u7406\u884C\u4E3A\u65F6\u5019\uFF0C\u53EF\u4EE5\u901A\u8FC7\u4EE5\u4E0B\u65B9\u5F0F\u6765\u5B9E\u73B0\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u6837\u5BF9\u4E8E ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u548C ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4E0B\u9762\u7684\u4F9D\u8D56\u90FD\u4F1A\u8FDB\u884C\u6253\u5305\u5904\u7406\u3002\u5982\u679C\u53EA\u60F3\u8981\u5173\u95ED\u5176\u4E2D\u67D0\u4E2A\u4E0B\u9762\u7684\u4F9D\u8D56\u5904\u7406\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," \u7684\u5BF9\u8C61\u5F62\u5F0F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"dependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u9700\u8981\u5916\u7F6E\u9879\u76EE\u7684 ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," \u4F9D\u8D56\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E3A\u6BCF\u4E2A JS , CSS \u548C DTS \u6587\u4EF6\u7684\u9876\u90E8\u548C\u5E95\u90E8\u6CE8\u5165\u5185\u5BB9\u7684\u80FD\u529B\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C: ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\u4F60\u60F3\u4E3A JS \u548C CSS \u6587\u4EF6\u6DFB\u52A0\u7248\u6743\u4FE1\u606F:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6784\u5EFA\u7C7B\u578B\uFF0C",(0,i.jsx)(n.code,{children:"bundle"})," \u4F1A\u6253\u5305\u4F60\u7684\u4EE3\u7801\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u53EA\u505A\u4EE3\u7801\u7684\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5C06\u6587\u4EF6\u6216\u76EE\u5F55\u62F7\u8D1D\u5230\u6307\u5B9A\u4F4D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n copy: {\n patterns: [{ from: './src/assets', to: '' }],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": \u6307\u5B9A\u5E76\u884C\u6267\u884C\u591A\u5C11\u4E2A\u590D\u5236\u4EFB\u52A1\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": \u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})}),"\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4E0B ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"\u3002"]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5B9A\u4E49\u5168\u5C40\u53D8\u91CF\uFF0C\u6CE8\u5165\u5230\u4EE3\u7801\u4E2D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u7531\u4E8E ",(0,i.jsx)(n.code,{children:"define"})," \u529F\u80FD\u662F\u7531\u5168\u5C40\u6587\u672C\u66FF\u6362\u5B9E\u73B0\u7684\uFF0C\u6240\u4EE5\u9700\u8981\u4FDD\u8BC1\u5168\u5C40\u53D8\u91CF\u503C\u4E3A\u5B57\u7B26\u4E32\uFF0C\u66F4\u4E3A\u5B89\u5168\u7684\u505A\u6CD5\u662F\u5C06\u6BCF\u4E2A\u5168\u5C40\u53D8\u91CF\u7684\u503C\u8F6C\u5316\u4E3A\u5B57\u7B26\u4E32\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6846\u67B6\u5185\u90E8\u4F1A\u81EA\u52A8\u8FDB\u884C JSON \u5E8F\u5217\u5316\u5904\u7406\uFF0C\u56E0\u6B64\u4E0D\u9700\u8981\u624B\u52A8\u6267\u884C\u5E8F\u5217\u5316\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u9700\u8981\u81EA\u52A8\u5E8F\u5217\u5316\uFF0C\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"/api/config/build-config.html#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," \u5B9A\u4E49 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," \u6765\u5B9E\u73B0\u3002\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0D\u8FC7\u8981\u6CE8\u610F\uFF1A\u5982\u679C\u9879\u76EE\u662F\u4E00\u4E2A TypeScript \u9879\u76EE\uFF0C\u90A3\u4E48\u4F60\u53EF\u80FD\u9700\u8981\u5728\u9879\u76EE\u6E90\u4EE3\u7801\u76EE\u5F55\u4E0B\u7684 ",(0,i.jsx)(n.code,{children:".d.ts"})," \u6587\u4EF6\u91CC\u589E\u52A0\u4EE5\u4E0B\u5185\u5BB9\uFF1A"]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4E0D\u5B58\u5728 ",(0,i.jsx)(n.code,{children:"d.ts"})," \u6587\u4EF6\uFF0C\u5219\u53EF\u4EE5\u624B\u52A8\u521B\u5EFA\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u4E5F\u53EF\u4EE5\u8FDB\u884C\u73AF\u5883\u53D8\u91CF\u66FF\u6362\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u901A\u8FC7\u4E0A\u9762\u7684\u914D\u7F6E\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u5C06\u4E0B\u9762\u8FD9\u6BB5\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u524D\u4EE3\u7801\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"})," \u7684\u65F6\u5019\uFF0C\u8F6C\u6362\u4E3A\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// \u7F16\u8BD1\u540E\u4EE3\u7801\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u4E3A\u4E86\u9632\u6B62\u5168\u5C40\u66FF\u6362\u66FF\u6362\u8FC7\u5EA6\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u65F6\u9075\u5FAA\u4EE5\u4E0B\u4E24\u4E2A\u539F\u5219\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u5168\u5C40\u5E38\u91CF\u4F7F\u7528\u5927\u5199"}),"\n",(0,i.jsx)(n.li,{children:"\u81EA\u5B9A\u4E49\u5168\u5C40\u5E38\u91CF\u524D\u7F00\u540E\u7F00\uFF0C\u786E\u4FDD\u72EC\u4E00\u65E0\u4E8C"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7C7B\u578B\u6587\u4EF6\u751F\u6210\u7684\u76F8\u5173\u914D\u7F6E\uFF0C\u9ED8\u8BA4\u60C5\u51B5\u4F1A\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u63A7\u5236\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\uFF0C\u662F\u5426\u5141\u8BB8\u6784\u5EFA\u6210\u529F\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u5728\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u7684\u65F6\u5019\u4F1A\u5BFC\u81F4\u6784\u5EFA\u5931\u8D25"}),"\u3002\u5C06 ",(0,i.jsx)(n.code,{children:"abortOnError"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u540E\uFF0C\u5373\u4F7F\u4EE3\u7801\u4E2D\u51FA\u73B0\u4E86\u7C7B\u578B\u95EE\u9898\uFF0C\u6784\u5EFA\u4F9D\u7136\u4F1A\u6210\u529F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u5F53\u5173\u95ED\u8BE5\u914D\u7F6E\u540E\uFF0C\u65E0\u6CD5\u4FDD\u8BC1\u7C7B\u578B\u6587\u4EF6\u80FD\u6B63\u5E38\u751F\u6210\uFF0C\u4E14\u4E0D\u4FDD\u8BC1\u5185\u5BB9\u6B63\u786E\u3002\u5728 ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"})," \u65F6\uFF0C\u5373\u6253\u5305\u6A21\u5F0F\u4E0B\uFF0C\u7C7B\u578B\u6587\u4EF6\u4E00\u5B9A\u4E0D\u4F1A\u751F\u6210\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7C7B\u578B\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84\uFF0C\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})," \u8FDB\u884C\u8F93\u51FA\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6BD4\u5982\u8F93\u51FA\u5230 ",(0,i.jsx)(n.code,{children:"outDir"})," \u4E0B\u9762\u7684 ",(0,i.jsx)(n.code,{children:"types"})," \u76EE\u5F55\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F tsc '--build' \u9009\u9879\u3002\u5F53\u4F7F\u7528 project reference \u65F6\uFF0C\n\u53EF\u4EE5\u4F7F\u7528 '--build' \u9009\u9879\u4EE5\u5B9E\u73B0\u9879\u76EE\u4E4B\u95F4\u7684\u534F\u540C\u5DE5\u4F5C\u4EE5\u52A0\u5FEB\u6784\u5EFA\u901F\u5EA6\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6B64\u9009\u9879\u8981\u6C42\u7248\u672C > 2.43.0\uFF0C\n\u4E8B\u5B9E\u4E0A\uFF0C\u6211\u4EEC\u5728 2.42.0 \u7248\u672C\u66FE\u8BD5\u9A8C\u6027\u5730\u5F00\u542F\u6B64\u9009\u9879\uFF0C\u4F46\u5176\u5E26\u6765\u7684\u8BB8\u591A\u95EE\u9898\u4F7F\u6211\u4EEC\u4E0D\u5F97\u4E0D\u52A8\u6001\u5F00\u542F\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0C\u4E3A\u4E86\u6EE1\u8DB3\u6784\u5EFA\u9700\u6C42\uFF0C\u4F60\u5FC5\u987B\u663E\u5F0F\u5730\u5728 tsconfig.json \u91CC\u8BBE\u7F6E 'declarationDir' \u6216\u8005 'outDir'\uFF0C\n\u5982\u679C\u4F60\u7528\u7684\u4E0D\u662F TS >= 5.0 \u7248\u672C\uFF0C\u4F60\u8FD8\u9700\u8981\u663E\u5F0F\u5730\u8BBE\u7F6E 'declaration' \u548C 'emitDeclarationOnly'\u3002\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u662F\u5426\u5728\u6784\u5EFA\u65F6\u53EA\u751F\u6210\u7C7B\u578B\u6587\u4EF6\uFF0C\u4E0D\u751F\u6210 JavaScript \u4EA7\u7269\u6587\u4EF6\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"false"})," \u65F6\uFF0C\u4E0D\u4F1A\u6253\u5305\u4EFB\u4F55\u4E09\u65B9\u5305\u7C7B\u578B\uFF0C\u8BBE\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u65F6\uFF0C\u4F1A\u6839\u636E ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"})," \u6765\u51B3\u5B9A\u662F\u5426\u9700\u8981\u6253\u5305\u4E09\u65B9\u7C7B\u578B\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u5BF9\u7C7B\u578B\u6587\u4EF6\u8FDB\u884C\u6253\u5305\u65F6\uFF0C\u6784\u5EFA\u5DE5\u5177\u8FD8\u672A\u5BF9 export \u8FDB\u884C\u5206\u6790\uFF0C\u56E0\u6B64\u5F53\u4F60\u5F15\u7528\u7684\u4EFB\u4F55\u4E00\u4E2A\u4E09\u65B9\u5305\u51FA\u73B0\u7C7B\u578B\u9519\u8BEF\u65F6\uFF0C\u90FD\u53EF\u80FD\u4F1A\u4E2D\u65AD\u5F53\u524D\u7684\u6784\u5EFA\u6D41\u7A0B\uFF0C\u8FD9\u4F1A\u5BFC\u81F4\u6784\u5EFA\u6D41\u7A0B\u4E0D\u53EF\u63A7\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u8FD9\u4E2A\u914D\u7F6E\u6765\u907F\u514D\u8BE5\u95EE\u9898\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"\u5E9F\u5F03"}),"\uFF0C\u4F7F\u7528 ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," \u914D\u7F6E\u66FF\u4EE3\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u7528\u4E8E\u751F\u6210\u7C7B\u578B\u6587\u4EF6\u7684 tsconfig \u6587\u4EF6\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539\u5E95\u5C42\u7684 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild \u914D\u7F6E"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6211\u4EEC\u9700\u8981\u4FEE\u6539\u751F\u6210\u6587\u4EF6\u7684\u540E\u7F00\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u4F8B\u5982\uFF0C\u6CE8\u518C\u4E00\u4E2A esbuild \u63D2\u4EF6\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u589E\u52A0 esbuild \u63D2\u4EF6\u65F6\uFF0C\u8BF7\u6CE8\u610F\u4F60\u9700\u8981\u5C06\u63D2\u4EF6\u52A0\u5728 plugins \u6570\u7EC4\u7684\u5934\u90E8\uFF0C\u56E0\u4E3A Modern.js Module \u5185\u90E8\u4E5F\u662F\u901A\u8FC7\u4E00\u4E2A esbuild \u63D2\u4EF6\u4ECB\u5165\u5230\u6574\u4E2A\u6784\u5EFA\u6D41\u7A0B\u4E2D\u53BB\u7684\uFF0C\u56E0\u6B64\u9700\u8981\u5C06\u81EA\u5B9A\u4E49\u63D2\u4EF6\u4F18\u5148\u6CE8\u518C\u3002"}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"\u6211\u4EEC\u5728\u539F\u672C esbuild \u6784\u5EFA\u7684\u57FA\u7840\u4E0A\u505A\u4E86\u8BB8\u591A\u6269\u5C55\uFF0C\u56E0\u6B64\u4F7F\u7528\u6B64\u914D\u7F6E\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["\u4F18\u5148\u4F7F\u7528 Modern.js Module \u63D0\u4F9B\u7684\u914D\u7F6E\uFF0C\u4F8B\u5982 esbuild \u5E76\u4E0D\u652F\u6301 ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\uFF0C\u4F46\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 SWC \u652F\u6301\u4E86\u6B64\u573A\u666F\uFF0C\u6B64\u65F6\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"esbuildOptions"})," \u8BBE\u7F6E",(0,i.jsx)(n.code,{children:"target: 'es5'"}),"\u4F1A\u62A5\u9519\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u76EE\u524D\u6211\u4EEC\u5185\u90E8\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"enhanced-resolve"})," \u66FF\u4EE3\u4E86 esbuild \u7684 resolve \u89E3\u6790\u7B97\u6CD5\uFF0C\u6240\u4EE5\u4FEE\u6539 esbuild resolve \u76F8\u5173\u914D\u7F6E\u65E0\u6548\uFF0C\u8BA1\u5212\u5728\u672A\u6765\u4F1A\u5207\u6362\u56DE\u6765\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u8F93\u51FA\u7684 JS \u4EE3\u7801\u53EF\u80FD\u4F1A\u4F9D\u8D56\u4E00\u4E9B\u8F85\u52A9\u51FD\u6570\u6765\u652F\u6301\u76EE\u6807\u73AF\u5883\u6216\u8005\u8F93\u51FA\u683C\u5F0F\uFF0C\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u4F1A\u88AB\u5185\u8054\u5728\u9700\u8981\u5B83\u7684\u6587\u4EF6\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\uFF0C\u5C06\u5185\u8054\u7684\u8F85\u52A9\u51FD\u6570\u8F6C\u6362\u4E3A\u4ECE\u5916\u90E8\u6A21\u5757 ",(0,i.jsx)(n.code,{children:"@swc/helpers"})," \u5BFC\u5165\u8FD9\u4E9B\u8F85\u52A9\u51FD\u6570\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u4E0B\u9762\u662F\u4F7F\u7528\u8BE5\u914D\u7F6E\u524D\u540E\u7684\u4EA7\u7269\u53D8\u5316\u6BD4\u8F83\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u524D\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u8F85\u52A9\u51FD\u6570\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// \u8F85\u52A9\u51FD\u6570\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// \u4ECE @swc/helpers \u5BFC\u5165\u7684\u8F85\u52A9\u51FD\u6570\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// \u4F60\u7684\u4EE3\u7801\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u7528\u4E8E\u5728\u6253\u5305\u65F6\u6392\u9664\u4E00\u4E9B\u5916\u90E8\u4F9D\u8D56\uFF0C\u907F\u514D\u5C06\u8FD9\u4E9B\u4F9D\u8D56\u6253\u5305\u5230\u6700\u7EC8\u7684 bundle \u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Externals = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // \u907F\u514D\u6253\u5305 React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u540C ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," \u914D\u7F6E\uFF0C\u7528\u4E8E\u5728\u8F93\u51FA\u6587\u4EF6\u672B\u5C3E\u6DFB\u52A0\u6CE8\u91CA\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u8BBE\u7F6E JavaScript \u4EA7\u7269\u8F93\u51FA\u7684\u683C\u5F0F\uFF0C\u5176\u4E2D ",(0,i.jsx)(n.code,{children:"iife"})," \u548C ",(0,i.jsx)(n.code,{children:"umd"})," \u53EA\u5728 ",(0,i.jsx)(n.code,{children:"buildType"})," \u4E3A ",(0,i.jsx)(n.code,{children:"bundle"})," \u65F6\u751F\u6548\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'esm \u4EE3\u8868 "ECMAScript \u6A21\u5757"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 import \u548C export \u8BED\u6CD5\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'cjs \u4EE3\u8868 "CommonJS"\uFF0C\u5B83\u9700\u8981\u8FD0\u884C\u73AF\u5883\u652F\u6301 exports\u3001require \u548C module \u8BED\u6CD5\uFF0C\u901A\u5E38\u4E3A Node.js \u73AF\u5883\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'iife \u4EE3\u8868 "\u7ACB\u5373\u8C03\u7528\u51FD\u6570\u8868\u8FBE\u5F0F"\uFF0C\u5B83\u5C06\u4EE3\u7801\u5305\u88F9\u5728\u51FD\u6570\u8868\u8FBE\u5F0F\u4E2D\uFF0C\u786E\u4FDD\u4EE3\u7801\u4E2D\u7684\u4EFB\u4F55\u53D8\u91CF\u4E0D\u4F1A\u610F\u5916\u5730\u4E0E\u5168\u5C40\u8303\u56F4\u4E2D\u7684\u53D8\u91CF\u51B2\u7A81\uFF0C\u901A\u5E38\u5728\u6D4F\u89C8\u5668\u73AF\u5883\u4E2D\u8FD0\u884C\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:'umd \u4EE3\u8868 "Universal Module Definition"\uFF0C\u7528\u4E8E\u5728\u4E0D\u540C\u73AF\u5883\uFF08\u6D4F\u89C8\u5668\u3001Node.js \u7B49\uFF09\u4E2D\u8FD0\u884C\u3002umd \u683C\u5F0F\u7684\u6A21\u5757\u53EF\u4EE5\u5728\u591A\u79CD\u73AF\u5883\u4E0B\u4F7F\u7528\uFF0C\u65E2\u53EF\u4EE5\u4F5C\u4E3A\u5168\u5C40\u53D8\u91CF\u8BBF\u95EE\uFF0C\u4E5F\u53EF\u4EE5\u901A\u8FC7\u6A21\u5757\u52A0\u8F7D\u5668\uFF08\u5982 RequireJS\uFF09\u8FDB\u884C\u6A21\u5757\u5316\u52A0\u8F7D\u3002'}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6784\u5EFA\u751F\u547D\u5468\u671F\u94A9\u5B50,\u5141\u8BB8\u5728\u6784\u5EFA\u6D41\u7A0B\u7684\u7279\u5B9A\u9636\u6BB5\u6CE8\u5165\u81EA\u5B9A\u4E49\u903B\u8F91\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u53EF\u4EE5\u5728 apply \u65B9\u6CD5\u91CC\u62FF\u5230 compiler \u5B9E\u4F8B\uFF0C\u4FEE\u6539\u5176\u5C5E\u6027\uFF0C\u4EE5\u53CA\u5728\u4E0D\u540C\u9636\u6BB5\u6267\u884C\u81EA\u5B9A\u4E49\u903B\u8F91\uFF0C\u5BF9\u4E8E Hook \u7684\u8BE6\u7EC6\u4ECB\u7ECD\uFF0C\n\u53C2\u8003",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html#%E4%BD%BF%E7%94%A8-hook-%E4%BB%8B%E5%85%A5%E6%9E%84%E5%BB%BA%E6%B5%81%E7%A8%8B",children:"\u4F7F\u7528 Hook \u4ECB\u5165\u6784\u5EFA\u6D41\u7A0B"}),"\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u6570\u7EC4\u5F62\u5F0F\u53EF\u4EE5\u6307\u5B9A\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src/index.ts']"}),"\uFF0C",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"['src']"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u6570\u7EC4\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u4EE5 ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u548C ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," \u4E3A\u5165\u53E3\u5206\u522B\u8FDB\u884C\u6784\u5EFA\u3002",(0,i.jsx)(n.code,{children:"bundle"})," \u6A21\u5F0F\u4E0D\u652F\u6301\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"input"})," \u4E3A\u76EE\u5F55\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u4E0B\u9762\u7684\u914D\u7F6E\u4F1A\u540C\u65F6\u5904\u7406 ",(0,i.jsx)(n.code,{children:"src/a"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"src/index.ts"})," \u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6A21\u5F0F\u4E0B\uFF0C\u6570\u7EC4\u6A21\u5F0F\u8FD8\u652F\u6301\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"!"})," \u6765\u8FC7\u6EE4\u90E8\u5206\u6587\u4EF6\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4E0A\u9762\u7684\u914D\u7F6E\u5C06\u6253\u5305 ",(0,i.jsx)(n.code,{children:"src"})," \u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\uFF0C\u540C\u65F6\u4F1A\u8FC7\u6EE4\u4EE5 ",(0,i.jsx)(n.code,{children:"spec.ts"})," \u4E3A\u540E\u7F00\u7684\u6587\u4EF6\u3002\u8FD9\u5728\u6D4B\u8BD5\u6587\u4EF6\u4E0E\u6E90\u7801\u6587\u4EF6\u5728\u540C\u4E00\u4E2A\u6839\u76EE\u5F55\u4E0B\u7684\u60C5\u51B5\u4F1A\u5F88\u6709\u7528\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7528\u6CD5\uFF1A"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5728 bundle \u6A21\u5F0F\u4E0B\u9700\u8981\u4FEE\u6539\u4EA7\u7269\u7684\u8F93\u51FA\u6587\u4EF6\u540D\u79F0\u7684\u65F6\u5019\uFF0C\u53EF\u4EE5\u4F7F\u7528\u5BF9\u8C61\u5F62\u5F0F\u8FDB\u884C\u914D\u7F6E\u3002"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"\u5BF9\u8C61\u7684 Key \u662F\u4EA7\u7269\u7684\u6587\u4EF6\u540D\u79F0\uFF0CValue \u662F\u6E90\u7801\u7684\u6587\u4EF6\u8DEF\u5F84\u3002"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A JSX \u7684\u7F16\u8BD1\u65B9\u5F0F\uFF0C\u9ED8\u8BA4\u652F\u6301 React 17 \u53CA\u66F4\u9AD8\u7248\u672C\uFF0C\u81EA\u52A8\u6CE8\u5165 JSX \u8FD0\u884C\u65F6\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"automatic | transform | preserve"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u652F\u6301 React 16\uFF0C\u5219\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"transform"}),"\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u4E0D\u9700\u8981\u8F6C\u6362 JSX ,\u53EF\u4EE5\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"jsx"})," \u4E3A ",(0,i.jsx)(n.code,{children:"preserve"}),", \u4F46\u6B64\u65F6\u8BF7\u4E0D\u8981",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#%E4%BD%BF%E7%94%A8-swc",children:"\u4F7F\u7528 swc"})," \u505A\u4EE3\u7801\u8F6C\u6362\u3002\n\u5173\u4E8E JSX Transform \u7684\u66F4\u591A\u8BF4\u660E\uFF0C\u53EF\u4EE5\u53C2\u8003\u4EE5\u4E0B\u94FE\u63A5\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u8FD9\u4E2A\u9009\u9879\u7528\u4E8E\u6784\u5EFA\u5206\u6790\uFF0C\u5F00\u542F\u8BE5\u9009\u9879\u540E\uFF0Cesbuild \u4F1A\u4EE5 JSON \u683C\u5F0F\u751F\u6210\u6709\u5173\u6784\u5EFA\u7684\u4E00\u4E9B\u5143\u6570\u636E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u6784\u5EFA\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"\u4EC5\u652F\u6301 buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"metafile"})," \u751F\u6210\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u6267\u884C build \u6784\u5EFA\u540E\uFF0C\u4EA7\u7269\u76EE\u5F55\u4E0B\u4F1A\u751F\u6210 ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," \u6587\u4EF6\uFF0C\u4F60\u53EF\u4EE5\u901A\u8FC7 ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," \u548C ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," \u7B49\u5DE5\u5177\u8FDB\u884C\u53EF\u89C6\u5316\u5206\u6790\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F7F\u7528 esbuild \u6216\u8005 terser \u538B\u7F29\u4EE3\u7801\uFF0C\u4E5F\u53EF\u4EE5\u4F20\u5165 ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A\u6784\u5EFA\u7684\u8F93\u51FA\u76EE\u5F55\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u9ED8\u8BA4\u751F\u6210\u7528\u4E8E Node.js \u73AF\u5883\u4E0B\u7684\u4EE3\u7801\uFF0C\u4F60\u4E5F\u53EF\u4EE5\u6307\u5B9A\u4E3A ",(0,i.jsx)(n.code,{children:"browser"}),"\uFF0C\u4F1A\u751F\u6210\u7528\u4E8E\u6D4F\u89C8\u5668\u73AF\u5883\u7684\u4EE3\u7801\u3002\n\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728 ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," \u6784\u5EFA\u6A21\u5F0F\u4E0B\uFF0C\u4F1A\u5BF9\u5F15\u7528\u8DEF\u5F84\u8FDB\u884C\u91CD\u5B9A\u5411\uFF0C\u786E\u4FDD\u6307\u5411\u4E86\u6B63\u786E\u7684\u4EA7\u7269\uFF0C\u4F8B\u5982\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import './index.less'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import './index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from './close.svg'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import icon from '../asset/close.svg'"}),"\uFF08\u4F9D\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A\uFF09"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," \u4F1A\u88AB\u6539\u5199\u6210 ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (\u5982\u679C\u751F\u6210\u4E86 utils.mjs\uFF0C\u89C6\u5B9E\u9645\u60C5\u51B5\u800C\u5B9A)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u67D0\u4E9B\u573A\u666F\u4E0B\uFF0C\u4F60\u53EF\u80FD\u4E0D\u9700\u8981\u8FD9\u4E9B\u529F\u80FD\uFF0C\u90A3\u4E48\u53EF\u4EE5\u901A\u8FC7\u6B64\u914D\u7F6E\u5173\u95ED\u5B83\uFF0C\u5173\u95ED\u540E\uFF0C\u5176\u5F15\u7528\u8DEF\u5F84\u5C06\u4E0D\u4F1A\u53D1\u751F\u6539\u53D8\u3002"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // \u5173\u95ED\u5BF9\u522B\u540D\u8DEF\u5F84\u7684\u4FEE\u6539\n style: false, // \u5173\u95ED\u5BF9\u6837\u5F0F\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n asset: false, // \u5173\u95ED\u5BF9\u8D44\u6E90\u6587\u4EF6\u8DEF\u5F84\u7684\u4FEE\u6539\n autoExtension: false, // \u5173\u95ED\u5BF9 js \u6587\u4EF6\u540E\u7F00\u7684\u4FEE\u6539\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u81EA\u5B9A\u4E49\u6A21\u5757\u89E3\u6790\u9009\u9879"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvealias",children:["resolve.alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvealias",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u57FA\u672C\u7528\u6CD5\u548C ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u4E00\u81F4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u7684\u95EE\u9898\u5728\u4E8E\u6211\u4EEC\u5728 bundleless \u573A\u666F\u4E0B\u9519\u8BEF\u7684\u5904\u7406\u4E86 Module ID \u7684\u60C5\u51B5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "react";\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u5F53\u6211\u4EEC\u914D\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"alias: { react: 'react-native' }"})," \u540E\uFF0C\u7ED3\u679C\u4F1A\u53D8\u6210"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "./react-native";\n'})}),"\n",(0,i.jsx)(n.p,{children:"\u4E00\u4E2A Module ID \u88AB\u9519\u8BEF\u7684\u5904\u7406\u6210\u4E86\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u663E\u7136\u8FD9\u662F\u4E0D\u7B26\u5408\u9884\u671F\u7684\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u6211\u4EEC\u60F3\u8981\u4FEE\u590D\u8FD9\u4E2A\u95EE\u9898\uFF0C\u4F46\u662F\u8FD9\u53EF\u80FD\u4F1A\u7834\u574F\u5DF2\u6709\u7684\u9879\u76EE\uFF0C\u56E0\u6B64\u6211\u4EEC\u5728 2.58.0 \u7248\u672C\u63D0\u4F9B\u4E86 ",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u6765\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\u3002\n\u5E76\u4E14 ",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u91CC\u79FB\u9664\u4E86 ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u63D0\u4F9B\u7684\u9ED8\u8BA4\u503C ",(0,i.jsx)(n.code,{children:'{ "@": "./src"}'})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5982\u679C\u4F60\u9700\u8981\u6B64\u529F\u80FD\uFF0C\u8BF7\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"resolve.alias"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4E0B\u4E00\u4E2A\u5927\u7248\u672C\uFF0C",(0,i.jsx)(n.code,{children:"resolve.alias"})," \u5C06\u4F1A\u53D6\u4EE3 ",(0,i.jsx)(n.code,{children:"alias"})," \u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u6CE8\u610F\u6B64\u914D\u7F6E\u4E0D\u8981\u4E0E ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," \u6DF7\u7528\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u6CE8\u610F\u6B64\u914D\u7F6E\u5FC5\u987B\u6807\u6CE8\u4E00\u4E2A\u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4F8B\u5982 ",(0,i.jsx)(n.code,{children:'{ "@": "./src" }'})," \u800C\u975E ",(0,i.jsx)(n.code,{children:'{ "@": "src"}'}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"package.json \u4E2D\uFF0C\u5728\u89E3\u6790\u5305\u7684\u5165\u53E3\u70B9\u65F6\u5C1D\u8BD5\u7684\u5B57\u6BB5\u5217\u8868\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A\u53D6\u51B3\u4E8E",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u6211\u4EEC\u60F3\u8981\u5148\u52A0\u8F7D ",(0,i.jsx)(n.code,{children:"js:source"})," \u5B57\u6BB5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u6BD4 package.json \u4E2D exports \u5B57\u6BB5\u7684\u4F18\u5148\u7EA7\u4F4E\uFF0C\u5982\u679C\u4E00\u4E2A\u5165\u53E3\u70B9\u4ECE exports \u6210\u529F\u89E3\u6790\uFF0C",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," \u5C06\u88AB\u5FFD\u7565\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u652F\u6301\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E css \u6587\u4EF6\uFF0C\u8BF7\u4E0D\u8981\u4F7F\u7528\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u76EE\u524D Module \u4EC5\u652F\u6301 ['.less', '.css', '.sass', '.scss'] \u540E\u7F00\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["Node \u7684\u89E3\u6790\u7B97\u6CD5\u4E0D\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:".mjs"})," \u548C ",(0,i.jsx)(n.code,{children:"cjs"})," \u89C6\u4E3A\u9690\u5F0F\u6587\u4EF6\u6269\u5C55\u540D\uFF0C\u56E0\u6B64\u8FD9\u91CC\u9ED8\u8BA4\u4E5F\u4E0D\u4F1A\uFF0C\u4F46\u662F\u53EF\u4EE5\u901A\u8FC7\u66F4\u6539\u6B64\u914D\u7F6E\u6765\u5305\u542B\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u5728\u6784\u5EFA cjs / esm \u4EA7\u7269\u65F6\u6CE8\u5165\u4E00\u4E9B\u57AB\u7247\u4EE3\u7801\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u53EA\u80FD\u5728 commonjs \u91CC\u4F7F\u7528\uFF0C\u5F00\u542F\u6B64\u9009\u9879\u540E\uFF0C\u5F53\u4EA7\u7269\u683C\u5F0F\u4E3A esm \u65F6\uFF0C\u4F1A\u5C06 ",(0,i.jsx)(n.code,{children:"__dirname"})," \u7F16\u8BD1\u4E3A ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"}),"\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u4EE3\u7801\u89C1 ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"shims"}),"\uFF0C\n\u9700\u8981\u6CE8\u610F\u7684\u662F esm shims \u53EA\u4F1A\u5728 ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," \u4E3A node \u65F6\u6CE8\u5165\uFF0C\u56E0\u4E3A\u7528\u5230\u4E86 url \u6A21\u5757\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u901A\u5E38\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u901A\u8FC7 package.json \u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u6765\u914D\u7F6E\u6A21\u5757\u7684\u526F\u4F5C\u7528\uFF0C\u4F46\u662F\u5728\u67D0\u4E9B\u60C5\u51B5\u4E0B\uFF0C\u4E09\u65B9\u5305\u7684 package.json \u662F\u4E0D\u53EF\u9760\u7684\u3002\n\u4F8B\u5982\u6211\u4EEC\u5F15\u7528\u4E86\u4E00\u4E2A\u4E09\u65B9\u5305\u7684\u6837\u5F0F\u6587\u4EF6\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F46\u662F\u8FD9\u4E2A\u4E09\u65B9\u5305\u7684 package.json \u91CC\u5E76\u6CA1\u6709\u5C06\u6837\u5F0F\u6587\u4EF6\u914D\u7F6E\u5230 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u91CC\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u540C\u65F6\u4F60\u53C8\u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," \u4E3A ",(0,i.jsx)(n.code,{children:"true"}),"\uFF0C\u5728\u63A7\u5236\u53F0\u53EF\u4EE5\u770B\u5230\u7C7B\u4F3C\u7684\u8B66\u544A\u4FE1\u606F\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u8FD9\u65F6\u5019\u5C31\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u914D\u7F6E\u9879\uFF0C\u624B\u52A8\u914D\u7F6E\u6A21\u5757\u7684",(0,i.jsx)(n.code,{children:'"sideEffects"'}),"\uFF0C\u914D\u7F6E\u652F\u6301\u6B63\u5219\u548C\u51FD\u6570\u5F62\u5F0F\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["\u6DFB\u52A0\u6B64\u914D\u7F6E\u540E\uFF0C\u6253\u5305\u65F6\u5C06\u4E0D\u4F1A\u518D\u8BFB\u53D6 package.json \u91CC\u7684 ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," \u5B57\u6BB5\u3002\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u6307\u5B9A\u6784\u5EFA\u7684\u6E90\u7801\u76EE\u5F55,\u9ED8\u8BA4\u4E3A ",(0,i.jsx)(n.code,{children:"src"}),"\uFF0C\u7528\u4E8E\u5728 ",(0,i.jsx)(n.code,{children:"bundleless"})," \u6784\u5EFA\u65F6\u57FA\u4E8E\u6E90\u7801\u76EE\u5F55\u7ED3\u6784\u751F\u6210\u5BF9\u5E94\u7684\u4EA7\u7269\u76EE\u5F55\u3002\n\u7B49\u540C\u4E8E",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63A7\u5236 sourceMap \u5982\u4F55\u751F\u6210\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"\u5DF2\u5E9F\u5F03\uFF0C\u6B64\u914D\u7F6E\u4E0D\u4F1A\u4EA7\u751F\u4EFB\u4F55\u5F71\u54CD\u3002"})})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u6E90\u7801\u7684\u683C\u5F0F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u4F1A\u5C06\u6E90\u7801\u4F5C\u4E3A EsModule \u8FDB\u884C\u5904\u7406\u3002\u5F53\u6E90\u7801\u4F7F\u7528\u7684\u662F CommonJS \u7684\u65F6\u5019\uFF0C\u9700\u8981\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"commonjs"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u5F00\u542F\u4EE3\u7801\u5206\u5272\u3002\n\u4EC5\u652F\u6301 ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," \u548C ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),"\uFF0C\u67E5\u770B",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"}),"\u4E86\u89E3\u66F4\u591A\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6837\u5F0F\u76F8\u5173\u7684\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Less"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Less"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"4.1.3"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Less"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sass",children:["sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Sass \u76F8\u5173\u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u5165\u53E3\u6587\u4EF6\u8D77\u59CB\u6DFB\u52A0 ",(0,i.jsx)(n.code,{children:"Sass"})," \u4EE3\u7801\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u914D\u7F6E ",(0,i.jsx)(n.code,{children:"Sass"})," \u4F7F\u7528\u7684\u5B9E\u73B0\u5E93\uFF0C\u5728\u4E0D\u6307\u5B9A\u7684\u60C5\u51B5\u4E0B\uFF0C\u4F7F\u7528\u7684\u5185\u7F6E\u7248\u672C\u662F ",(0,i.jsx)(n.code,{children:"1.5.4"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u53EF\u4EE5\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"string"})," \u7C7B\u578B\u65F6\uFF0C\u6307\u5B9A ",(0,i.jsx)(n.code,{children:"Sass"})," \u7684\u5B9E\u73B0\u5E93\u7684\u8DEF\u5F84"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u914D\u7F6E PostCSS \u7684\u9009\u9879\uFF0C\u4F20\u5165\u7684\u503C\u4F1A\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002\u6CE8\u610F ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u662F\u6D45\u62F7\u8D1D\uFF0C\u56E0\u6B64\u4F1A\u5B8C\u5168\u8986\u76D6\u5185\u7F6E\u7684 plugins \u6570\u7EC4\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u8BF7\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // \u4EE5\u4E0B\u63D2\u4EF6\u9ED8\u8BA4\u542F\u7528\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // \u4EE5\u4E0B\u63D2\u4EF6\u4EC5\u5728 target \u4E3A `es5` \u65F6\u542F\u7528\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u793A\u4F8B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u914D\u7F6E\u6253\u5305\u6A21\u5F0F\u4E0B\u662F\u5426\u5C06 CSS \u6837\u5F0F\u63D2\u5165\u5230 JavaScript \u4EE3\u7801\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5C06 ",(0,i.jsx)(n.code,{children:"inject"})," \u8BBE\u7F6E\u4E3A ",(0,i.jsx)(n.code,{children:"true"})," \u6765\u5F00\u542F\u6B64\u529F\u80FD\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5F00\u542F\u540E\uFF0C\u4F60\u4F1A\u770B\u5230\u6E90\u7801\u4E2D\u5F15\u7528\u7684 CSS \u4EE3\u7801\u88AB\u5305\u542B\u5728\u4E86\u6253\u5305\u540E\u7684 JS \u4EA7\u7269\u4E2D\u3002"}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u4F60\u5728\u6E90\u7801\u91CC\u5199\u4E86 ",(0,i.jsx)(n.code,{children:"import './index.scss'"}),"\uFF0C\u90A3\u4E48\u5728\u4EA7\u7269\u4E2D\u4F60\u4F1A\u770B\u5230\u4EE5\u4E0B\u4EE3\u7801\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["\u5F00\u542F ",(0,i.jsx)(n.code,{children:"inject"})," \u540E\uFF0C\u4F60\u9700\u8981\u6CE8\u610F\u4EE5\u4E0B\u51E0\u70B9\uFF1A"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["CSS \u6587\u4EF6\u4E2D\u7684 ",(0,i.jsx)(n.code,{children:"@import"})," \u4E0D\u4F1A\u88AB\u5904\u7406\u3002\u5982\u679C\u4F60\u7684 CSS \u6587\u4EF6\u4E2D\u6709 ",(0,i.jsx)(n.code,{children:"@import"})," \uFF0C\u90A3\u4E48\u4F60\u9700\u8981\u5728 JS \u6587\u4EF6\u4E2D\u624B\u52A8\u5F15\u5165 CSS \u6587\u4EF6\uFF08less,scss \u6587\u4EF6\u4E0D\u9700\u8981\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u4F1A\u6709\u9884\u5904\u7406\uFF09\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u9700\u8981\u8003\u8651 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u7684\u5F71\u54CD\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u7684\u6784\u5EFA\u5668\u4F1A\u8BA4\u4E3A CSS \u662F\u6709\u526F\u4F5C\u7528\u7684\uFF0C\u5982\u679C\u4F60\u7684\u9879\u76EE\u4E2D\u6216\u8005\u4E09\u65B9\u5305\u7684 package.json \u8BBE\u7F6E\u4E86 ",(0,i.jsx)(n.code,{children:"sideEffects"})," \u5B57\u6BB5\u5E76\u4E14\u6CA1\u6709\u5305\u542B\u6B64 CSS \u6587\u4EF6\uFF0C\u90A3\u4E48\u4F60\u5C06\u4F1A\u5F97\u5230\u4E00\u4E2A\u8B66\u544A\uFF1A"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\u53EF\u4EE5\u901A\u8FC7\u914D\u7F6E ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"})," \u6765\u89E3\u51B3\u3002"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6839\u636E\u6587\u4EF6\u540D\u81EA\u52A8\u542F\u7528 CSS Modules\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : \u4E3A\u4EE5 ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," \u6587\u4EF6\u540D\u7ED3\u5C3E\u7684\u6837\u5F0F\u6587\u4EF6\u542F\u7528 CSS Modules\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : \u7981\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : \u4E3A\u5339\u914D\u6B63\u5219\u6761\u4EF6\u7684\u6240\u6709\u6587\u4EF6\u542F\u7528 CSS Modules."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules \u914D\u7F6E\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4E00\u4E2A\u5E38\u7528\u7684\u914D\u7F6E\u662F ",(0,i.jsx)(n.code,{children:"localsConvention"}),"\uFF0C\u5B83\u53EF\u4EE5\u6539\u53D8 CSS Modules \u7684\u7C7B\u540D\u751F\u6210\u89C4\u5219\u3002"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u5BF9\u4E8E\u4EE5\u4E0B\u6837\u5F0F\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u4F60\u53EF\u4EE5\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," \u6765\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BE6\u7EC6\u914D\u7F6E\u67E5\u770B ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u7528\u4E8E\u4FEE\u6539 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"})," \u7684\u914D\u7F6E\u9879\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsx)(n.li,{children:"\u9ED8\u8BA4\u503C\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"\u542F\u7528-tailwind-css",children:["\u542F\u7528 Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u542F\u7528-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u5728\u4F7F\u7528 ",(0,i.jsx)(n.code,{children:"style.tailwindcss"})," \u4E4B\u524D\uFF0C\u4F60\u9700\u8981\u542F\u7528 Modern.js Module \u7684 Tailwind CSS \u63D2\u4EF6\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u8BF7\u9605\u8BFB",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss.html",children:"\u300C\u4F7F\u7528 Tailwind CSS\u300D"})," \u7AE0\u8282\u6765\u4E86\u89E3\u5F00\u542F\u65B9\u5F0F\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u7C7B\u578B",children:["\u7C7B\u578B",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u7C7B\u578B",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"object"})," \u7C7B\u578B\u65F6\uFF0C\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u503C\u4E3A ",(0,i.jsx)(n.code,{children:"Function"})," \u7C7B\u578B\u65F6\uFF0C\u51FD\u6570\u8FD4\u56DE\u7684\u5BF9\u8C61\u4E0E\u9ED8\u8BA4\u914D\u7F6E\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"Object.assign"})," \u5408\u5E76\u3002"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u7684\u4F7F\u7528\u65B9\u5F0F\u548C Tailwind CSS \u4E00\u81F4: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"\u5FEB\u901F\u4F20\u9001\u95E8"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h3,{id:"\u6CE8\u610F\u4E8B\u9879",children:["\u6CE8\u610F\u4E8B\u9879",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#\u6CE8\u610F\u4E8B\u9879",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6CE8\u610F\uFF1A"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u6587\u4EF6\u548C ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u9009\u9879\uFF0C\u90A3\u4E48 ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," \u5B9A\u4E49\u7684\u914D\u7F6E\u4F1A\u4F18\u5148\u751F\u6548\uFF0C\u5E76\u8986\u76D6 ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," \u4E2D\u5B9A\u4E49\u7684\u5185\u5BB9\u3002"]}),"\n",(0,i.jsxs)(n.li,{children:["\u5982\u679C\u4F60\u540C\u65F6\u4F7F\u7528\u4E86 ",(0,i.jsx)(n.code,{children:"designSystem"})," \u914D\u7F6E\u9879\uFF0C\u90A3\u4E48 Tailwind CSS \u7684 ",(0,i.jsx)(n.code,{children:"theme"})," \u914D\u7F6E\u5C06\u4F1A\u88AB ",(0,i.jsx)(n.code,{children:"designSystem"})," \u7684\u503C\u6240\u8986\u76D6\u3002"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u5176\u4ED6\u914D\u7F6E\u7684\u4F7F\u7528\u65B9\u5F0F\u4E0E Tailwind CSS \u5B98\u65B9\u7528\u6CD5\u4E00\u81F4\uFF0C\u8BF7\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"}),"\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," \u7528\u4E8E\u4E3A\u751F\u6210\u7684 JavaScript \u4EE3\u7801\u8BBE\u7F6E\u76EE\u6807\u73AF\u5883\u3002\u5B83\u8BA9 Modern.js Module \u5C06\u76EE\u6807\u73AF\u5883\u65E0\u6CD5\u8BC6\u522B\u7684 JavaScript \u8BED\u6CD5\u8F6C\u6362\u4E3A\u5728\u8FD9\u4E9B\u73AF\u5883\u4E2D\u53EF\u7528\u7684\u4F4E\u7248\u672C JavaScript \u8BED\u6CD5\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u7C7B\u578B\uFF1A"}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u4F8B\u5982\uFF0C\u5C06\u4EE3\u7801\u7F16\u8BD1\u5230 ",(0,i.jsx)(n.code,{children:"es5"})," \u8BED\u6CD5\uFF1A"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u63D0\u4F9B\u4E0E babel-plugin-import \u7B49\u4EF7\u7684\u80FD\u529B\u548C\u914D\u7F6E\uFF0C\u57FA\u4E8E SWC \u5B9E\u73B0\uFF0C\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["\u6570\u7EC4\u5143\u7D20\u4E3A\u4E00\u4E2A babel-plugin-import \u7684\u914D\u7F6E\u5BF9\u8C61\u3002\u914D\u7F6E\u5BF9\u8C61\u53EF\u4EE5\u53C2\u8003 ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:"\u4F7F\u7528\u793A\u4F8B\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import \u7684 options \u914D\u7F6E\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u53C2\u8003",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import.html#%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9",children:"\u300CImport \u63D2\u4EF6\u2014\u2014\u6CE8\u610F\u4E8B\u9879\u300D"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["\u662F\u5426\u6A21\u5757\u5316 ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," \u7684\u5BFC\u5165\uFF0C\u5220\u9664\u672A\u4F7F\u7528\u7684 lodash \u6A21\u5757\uFF0C\u4ECE\u800C\u51CF\u5C11 lodash \u4EE3\u7801\u4F53\u79EF\u3002\u8FD9\u9879\u4F18\u5316\u57FA\u4E8E ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," \u548C ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," \u5B9E\u73B0\u3002\n\u4F7F\u7528\u6B64\u914D\u7F6E\uFF0C\u5C06\u4F1A\u4F7F\u7528 SWC \u5BF9\u4EE3\u7801\u8FDB\u884C\u8F6C\u6362\u3002"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"\u5F53\u5F00\u542F\u6B64\u9009\u9879\u65F6\uFF0CModern.js Module \u4F1A\u81EA\u52A8\u5C06 lodash \u7684\u4EE3\u7801\u5F15\u7528\u6307\u5411\u5B50\u8DEF\u5F84\u3002"}),"\n",(0,i.jsx)(n.p,{children:"\u6BD4\u5982\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"\u8F6C\u6362\u540E\u7684\u4EE3\u7801\uFF1A"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"TypeScript \u914D\u7F6E\u6587\u4EF6\u7684\u8DEF\u5F84\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u7248\u672C\uFF1A ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6\uFF0C",(0,i.jsx)(n.code,{children:"react"})," \u548C ",(0,i.jsx)(n.code,{children:"react-dom"})," \u4F1A\u88AB\u770B\u505A\u662F\u5916\u90E8\u5BFC\u5165\u7684\u5168\u5C40\u53D8\u91CF\uFF0C\u4E0D\u4F1A\u88AB\u6253\u5305\u8FDB UMD \u4EA7\u7269\u4E2D\uFF0C\u800C\u662F\u901A\u8FC7 ",(0,i.jsx)(n.code,{children:"global.React"})," \u548C ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})," \u7684\u65B9\u5F0F\u8FDB\u884C\u8BBF\u95EE\u3002"]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"\u6307\u5B9A UMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u3002"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\u7C7B\u578B\uFF1A ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:["\u9ED8\u8BA4\u503C\uFF1A ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["\u6B64\u65F6 UMD \u4EA7\u7269\u4F1A\u53BB\u6302\u8F7D\u5230 ",(0,i.jsx)(n.code,{children:"global.myLib"})," \u4E0A\u3002"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"\u9700\u8981\u9075\u5B88 UMD \u89C4\u8303\uFF0CUMD \u4EA7\u7269\u7684\u6A21\u5757\u540D\u4E0D\u80FD\u548C\u5168\u5C40\u53D8\u91CF\u540D\u51B2\u7A81\u3002"}),"\n",(0,i.jsxs)(n.li,{children:["\u6A21\u5757\u540D\u4F1A\u88AB\u8F6C\u6362\u4E3A\u9A7C\u5CF0\u547D\u540D\uFF0C\u5982 ",(0,i.jsx)(n.code,{children:"my-lib"})," \u4F1A\u88AB\u8F6C\u6362\u4E3A ",(0,i.jsx)(n.code,{children:"myLib"}),"\uFF0C\u53EF\u53C2\u8003",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),"\u3002"]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsx)(n.p,{children:"\u540C\u65F6\u51FD\u6570\u5F62\u5F0F\u53EF\u4EE5\u63A5\u6536\u4E00\u4E2A\u53C2\u6570\uFF0C\u4E3A\u5F53\u524D\u6253\u5305\u6587\u4EF6\u7684\u8F93\u51FA\u8DEF\u5F84"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n});\n```import { aliases } from '../../../../../../toolkit/utils/dist/compiled/browserslist';\nimport { createElement } from 'react';\n\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,d.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(r,{...e})}):r(e)}let c=l;l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["zh%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.alias",id:"resolvealias",depth:3},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"sass",id:"sass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"\u542F\u7528 Tailwind CSS",id:"\u542F\u7528-tailwind-css",depth:3},{text:"\u7C7B\u578B",id:"\u7C7B\u578B",depth:3},{text:"\u6CE8\u610F\u4E8B\u9879",id:"\u6CE8\u610F\u4E8B\u9879",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/async/5864.aa7a2878.js b/modern-js/module-tools/static/js/async/5864.cf8b0f83.js similarity index 60% rename from modern-js/module-tools/static/js/async/5864.aa7a2878.js rename to modern-js/module-tools/static/js/async/5864.cf8b0f83.js index dc1bc9b1d5..3a653bc730 100644 --- a/modern-js/module-tools/static/js/async/5864.aa7a2878.js +++ b/modern-js/module-tools/static/js/async/5864.cf8b0f83.js @@ -1 +1 @@ -"use strict";(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5864"],{8051:function(e,n,s){s.r(n),s.d(n,{default:function(){return d}});var i=s(9980),r=s(9580);function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",strong:"strong",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",ol:"ol",h3:"h3"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," is a configuration option that describes how to compile and generate build artifacts. It contains all the configurations related to the build process."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["Before start using ",(0,i.jsx)(n.code,{children:"buildConfig"}),", please read the following documentation to understand its purpose:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product.html",children:"Modifying Output Artifacts"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html",children:"In-Depth Understanding of the Build Process"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["For TypeScript projects, you only need to configure ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"})," in ",(0,i.jsx)(n.code,{children:"tsconfig.json"}),", Modern.js Module will automatically recognize the alias in ",(0,i.jsx)(n.code,{children:"tsconfig.json"}),", so there is no need to configure the ",(0,i.jsx)(n.code,{children:"alias"})," field additionally.\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: {\n '@common': '. /src/common',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After the above configuration is done, if ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"})," is referenced in the code, it will map to the ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," path."]}),"\n",(0,i.jsxs)(n.p,{children:["When the value of ",(0,i.jsx)(n.code,{children:"alias"})," is defined as a function, you can accept the pre-defined alias object and modify it."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: alias => {\n alias['@common'] = '. /src/common';\n },\n },\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"It is also possible to return a new object as the final result in the function, which will override the pre-defined alias object."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: alias => {\n return {\n '@common': '. /src/common',\n };\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Contains configuration related to static assets."}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Static resource output file name."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When asset.name is a string, it will automatically replace [name], [ext], and [hash], respectively replaced by the file name, extension, and file hash."}),"\n",(0,i.jsx)(n.p,{children:"Also you can use asset.name as a function, and the return is output asset name. At this time, this function receives a parameter assetPath, which corresponds to the resource path."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Used to set the threshold for static assets to be automatically inlined as base64."}),"\n",(0,i.jsx)(n.p,{children:"By default, Modern.js Module will inline assets such as images, fonts and media smaller than 10KB during bundling. They are Base64 encoded and inlined in the bundles, eliminating the need for separate HTTP requests."}),"\n",(0,i.jsxs)(n.p,{children:["You can adjust this threshold by modifying the ",(0,i.jsx)(n.code,{children:"limit"})," config."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, set ",(0,i.jsx)(n.code,{children:"limit"})," to ",(0,i.jsx)(n.code,{children:"0"})," to avoid assets inlining:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Static resource output path, will be based on ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"The CDN prefix given to unlinked assets when bundling."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, all static assets will be prefixed with ",(0,i.jsx)(n.code,{children:"https://xxx/"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Packaged to handle svg as a React component, options reference ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),", plus support for two configuration options ",(0,i.jsx)(n.code,{children:"include"})," and ",(0,i.jsx)(n.code,{children:"exclude"})," to match the svg file to be handled"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When svgr feature is enabled, you can use svg as a component using the default export."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive ",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["When enabled, the type of svg used can be modified by initing a new declaration file and adding to the ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Set the matching svg file"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Set unmatched svg files"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Used to configure the SVG export type when using SVGR."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"when it is 'named', use the following syntax:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The named export defaults to ",(0,i.jsx)(n.code,{children:"ReactComponent"}),", and can be customized with the ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Suffixes for js files and type description files in automation based on ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," and ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When disabled, js artifacts are suffixed with ",(0,i.jsx)(n.code,{children:".js"})," and type description files are suffixed with ",(0,i.jsx)(n.code,{children:"d.ts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["When enabled, node loads ",(0,i.jsx)(n.code,{children:".js"})," as esm by default when type is ",(0,i.jsx)(n.code,{children:"module"}),", so when we want to output cjs artifacts, the js product is suffixed with ",(0,i.jsx)(n.code,{children:".cjs"})," and the type description file is suffixed with ",(0,i.jsx)(n.code,{children:"d.cts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["On the other hand, if the type field is missing or the type is ",(0,i.jsx)(n.code,{children:"commonjs"}),", node loads the ",(0,i.jsx)(n.code,{children:".js"})," file as cjs by default.\nSo when we want to output esm output, the js output is suffixed with ",(0,i.jsx)(n.code,{children:".mjs"})," and the type description file is suffixed with ",(0,i.jsx)(n.code,{children:"d.mts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:[":::warning\nWhen used in bundleless mode, we have an extra step of processing the import/export statement in each file. We will suffix the relative path to the js file, possibly ",(0,i.jsx)(n.code,{children:".mjs"})," or ",(0,i.jsx)(n.code,{children:".cjs"}),", depending on your package configuration.\nYou can disable this step by ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Notice ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," will break this behavior, you should disable it.\nIf you need to use this configuration in bundleless, please patch the ",(0,i.jsx)(n.code,{children:"index"}),", e.g. if utils is a folder, you need to rewrite ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," to ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Automatically externalize project dependencies and peerDependencies and not package them into the final bundle"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When we want to turn off the default handling behavior for third-party dependencies, we can do so by:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["This way the dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," and ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," will be bundled. If you want to turn off the processing of only one of these dependencies, you can use the\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," in the form of an object."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether or not the dep dependencies of the external project are needed"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to require peerDep dependencies for external projects"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Provides the ability to inject content into the top and bottom of each JS , CSS and DTS file."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Let's say you want to add copyright information to JS and CSS files."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The build type, ",(0,i.jsx)(n.code,{children:"bundle"})," will package your code, ",(0,i.jsx)(n.code,{children:"bundleless"})," will only do the code conversion"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Copies the specified file or directory into the build output directory"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"export default {\n buildConfig: {\n copy: [{ from: '. /src/assets', to: '' }],\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Reference for array settings: ",(0,i.jsx)(n.a,{href:"https://github.com/webpack-contrib/copy-webpack-plugin#patterns",target:"_blank",rel:"noopener noreferrer",children:"copy-webpack-plugin patterns"})]}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": Specifies how many copy tasks to execute in parallel."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": Uses ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})})," by default, instead of ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Define global variables that will be injected into the code"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Since the ",(0,i.jsx)(n.code,{children:"define"})," function is implemented by global text replacement, you need to ensure that the global variable values are strings. A safer approach is to convert the value of each global variable to a string, as follows."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Modern.js automatically performs JSON serialization handling internally, so manual serialization is not required."}),"\n",(0,i.jsxs)(n.p,{children:["If automatic serialization is not needed, you can define ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," using ",(0,i.jsx)(n.a,{href:"/api/config/build-config.html#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," configuration."]}),"\n"]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If the project is a TypeScript project, then you may need to add the following to the ",(0,i.jsx)(n.code,{children:".d.ts"})," file in the project source directory."]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["If the ",(0,i.jsx)(n.code,{children:".d.ts"})," file does not exist, then you can create it manually."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can also replace environment variable:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"With the above configuration, we can put the following code."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// pre-compiler code\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["When executing ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"}),", the conversion is:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// compiled code\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"To prevent excessive global replacement substitution, it is recommended that the following two principles be followed when using"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Use upper case for global constants"}),"\n",(0,i.jsx)(n.li,{children:"Customize the prefix and suffix of global constants to ensure uniqueness"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"The dts file generates the relevant configuration, by default it generates."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to allow the build to succeed if a type error occurs."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"By default, type errors will cause the build to fail"}),". When ",(0,i.jsx)(n.code,{children:"abortOnError"})," is set to ",(0,i.jsx)(n.code,{children:"false"}),", the build will still succeed even if there are type issues in the code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["When this configuration is disabled, there is no guarantee that the type files will be generated correctly. In ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"}),", which is the bundle mode, type files will not be generated.\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The output path of the dts file, based on ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, output to the ",(0,i.jsx)(n.code,{children:"types"})," directory under the ",(0,i.jsx)(n.code,{children:"outDir"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Enable the tsc '--build' option. When using project reference,\nyou can use the '--build' option to achieve cooperation between projects and speed up the build speed."}),"\n",(0,i.jsx)(n.p,{children:"This option requires version > 2.43.0,In fact,\nwe experimentally enabled this option in the 2.42.0 version, but the many problems it brought forced us to enable it dynamically."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"When this option is enabled, to meet the build requirements, you must explicitly set 'declarationDir' or 'outDir' in tsconfig.json,\nIf you are not using TS >= 5.0 version, you also need to explicitly set 'declaration' and 'emitDeclarationOnly'.\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to generate only type files during the build process without generating JavaScript output files."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"deprecated"}),",use ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," instead."]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the path to the tsconfig file used to generate the type file."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When set to ",(0,i.jsx)(n.code,{children:"false"}),", the type of third-party packages will be excluded from the bundle, when set to ",(0,i.jsx)(n.code,{children:"true"}),", it will determine whether third-party types need to be bundled based on ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"When bundle d.ts, export is not analyzed, so any third-party package type you use may break your build, which is obviously uncontrollable.\nSo we can avoid it with this configuration."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to modify the ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild configuration"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"For example, if we need to modify the file extension of the generated files:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"For example, register an esbuild plugin:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"We have done many extensions based on the original esbuild build. Therefore, when using this configuration, pay attention to the following:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Prefer to use the configuration that Modern.js Module provides. For example, esbuild does not support ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),", but we support this scenario internally using SWC. Setting ",(0,i.jsx)(n.code,{children:"target: 'es5'"})," through esbuildOptions will result in an error."]}),"\n",(0,i.jsx)(n.li,{children:"Currently, we use enhanced-resolve internally to replace esbuild's resolve algorithm, so modifying esbuild resolve-related configurations is invalid. We plan to switch back in the future."}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"By default, the output JS code may depend on helper functions to support the target environment or output format, and these helper functions will be inlined in the file that requires it."}),"\n",(0,i.jsxs)(n.p,{children:["With this configuration, the code will be converted using SWC, it will inline helper functions to import them from the external module ",(0,i.jsx)(n.code,{children:"@swc/helpers"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Below is a comparison of the output file changes before and after using this configuration."}),"\n",(0,i.jsx)(n.p,{children:"Before enable:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// helper function\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// helper function\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// your code\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"After enabled:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// helper functions imported from @swc/helpers\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// your code\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure external dependencies that will not be bundled into the final bundle."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type External = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // do not bundle React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Same as the ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," configuration for adding a comment at the end of the output file."]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to set the output format of JavaScript files. The options ",(0,i.jsx)(n.code,{children:"iife"})," and ",(0,i.jsx)(n.code,{children:"umd"})," only take effect when ",(0,i.jsx)(n.code,{children:"buildType"})," is ",(0,i.jsx)(n.code,{children:"bundle"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"esm"}),' stands for "ECMAScript module" and requires the runtime environment to support import and export syntax.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"cjs"}),' stands for "CommonJS" and requires the runtime environment to support exports, require, and module syntax. This format is commonly used in Node.js environments.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"iife"}),' stands for "immediately-invoked function expression" and wraps the code in a function expression to ensure that any variables in the code do not accidentally conflict with variables in the global scope. This format is commonly used in browser environments.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"umd"}),' stands for "Universal Module Definition" and is used to run modules in different environments such as browsers and Node.js. Modules in UMD format can be used in various environments, either as global variables or loaded as modules using module loaders like RequireJS.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Build lifecycle hooks that allow custom logic to be injected at specific stages of the build process."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Types"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void.\n}\n\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["We can get the compiler instance in the apply method, modify its properties, and execute custom logic at different stages. For more information on Hooks, see [Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in the Build Process]).\nFor more information on Hooks, see ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html#using-hooks-to-intervene-in-the-build-process",children:"Using-hooks-to-intervene-in-the-build-process"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify the entry file for the build, in the form of an array that can specify the directory"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"['src/index.ts']"})," in ",(0,i.jsx)(n.code,{children:"bundle"})," mode, ",(0,i.jsx)(n.code,{children:"['src']"})," in ",(0,i.jsx)(n.code,{children:"bundleless"})," mode"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Array usage:"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundle"})," mode, the following configurations will be built using ",(0,i.jsx)(n.code,{children:"src/index.ts"})," and ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," as entry points. The ",(0,i.jsx)(n.code,{children:"bundle"})," mode does not support configuring ",(0,i.jsx)(n.code,{children:"input"})," as a directory."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundleless"})," mode, the following configuration compiles both files in the ",(0,i.jsx)(n.code,{children:"src/a"})," directory and ",(0,i.jsx)(n.code,{children:"src/index.ts"})," file."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundleless"})," mode, ",(0,i.jsx)(n.strong,{children:"Array usage"})," also supports the usage of ",(0,i.jsx)(n.code,{children:"!"})," to filter partial files:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The above configuration will build the files in the ",(0,i.jsx)(n.code,{children:"src"})," directory, and will also filter files with the ",(0,i.jsx)(n.code,{children:"spec.ts"})," suffix.This is useful in cases where the test files are in the same root directory as the source files."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Object usage:"})}),"\n",(0,i.jsx)(n.p,{children:"When you need to modify the output file name in bundle mode, you can use an object configuration."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"The key of the object is the file name of the output, and the value is the file path of the source code."})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify the compilation method for JSX, which by default supports React 17 and higher versions and automatically injects JSX runtime code."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"automatic | transform"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If you need to support React 16, you can set ",(0,i.jsx)(n.code,{children:"jsx"})," to ",(0,i.jsx)(n.code,{children:"transform"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["If you don't need to convert JSX, you can set ",(0,i.jsx)(n.code,{children:"jsx"})," to ",(0,i.jsx)(n.code,{children:"preserve"}),", but don't ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#use-swc",children:"use swc"})," to do the code conversion.\nFor more information about JSX Transform, you can refer to the following links:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"This option is used for build analysis. When enabled, esbuild will generate metadata about the build in JSON format."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["To enable ",(0,i.jsx)(n.code,{children:"metafile"})," generation:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After executing the build, a ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," file will be generated in the output directory. You can use tools like ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," and ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," for visual analysis."]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Use esbuild or terser to compress code, also pass ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the output directory of the build."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Generates code for the node environment by default, you can also specify ",(0,i.jsx)(n.code,{children:"browser"})," which will generate code for the browser environment.\nSee ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"})," learn more."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," build mode, the reference path is redirected to ensure that it points to the correct product, e.g:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import '. /index.less'"})," will be rewritten to ",(0,i.jsx)(n.code,{children:"import '. /index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from '. /close.svg'"})," would be rewritten as ",(0,i.jsx)(n.code,{children:"import icon from '... /asset/close.svg'"})," to ",(0,i.jsx)(n.code,{children:"import icon from '. /asset/close.svg'"})," (depending on the situation)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," will be rewritten to ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (if generate utils.mjs, depending on the situation)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"In some scenarios, you may not need these functions, then you can turn it off with this configuration, and its reference path will not be changed after turning it off."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // Turn off modifying alias paths\n style: false, // Turn off modifying the path to the style file\n asset: false, // Turn off modifying the path to the asset\n autoExtension: false, // Turn off modifying the suffix to the js file\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Custom module resolution options"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvealias",children:["resolve.alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvealias",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The basic usage is the same as ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The issue with ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," is that we incorrectly handled Module IDs in a bundleless scenario:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "react";\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When we configure alias: ",(0,i.jsx)(n.code,{children:"{ react: 'react-native' }"}),", the result becomes:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "./react-native";\n'})}),"\n",(0,i.jsx)(n.p,{children:"A Module ID is incorrectly processed as a relative path, which is not expected."}),"\n",(0,i.jsx)(n.p,{children:"We want to fix this issue, but it may break existing projects."}),"\n",(0,i.jsxs)(n.p,{children:["Therefore, in ",(0,i.jsx)(n.strong,{children:"2.58.0"}),", we provided ",(0,i.jsx)(n.code,{children:"resolve.alias"})," to solve this problem. Additionally, ",(0,i.jsx)(n.code,{children:"resolve.alias"})," removed the default value ",(0,i.jsx)(n.code,{children:'{ "@": "./src"}'})," provided by ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["If you need this feature, please use ",(0,i.jsx)(n.code,{children:"resolve.alias"})," and avoid mixing it with ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["In the next major version, ",(0,i.jsx)(n.code,{children:"resolve.alias"})," will replace ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"A list of fields in package.json to try when parsing the package entry point."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": depends on ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, we want to load the ",(0,i.jsx)(n.code,{children:"js:source"})," field first:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," has a lower priority than the exports field in package.json, and if an entry point is successfully resolved from exports, ",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," will be ignored.\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Support for implicit file extensions"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Do not use implicit file extensions for css files, currently Module only supports ['.less', '.css', '.sass', '.scss'] suffixes."}),"\n",(0,i.jsxs)(n.p,{children:["Node's parsing algorithm does not consider ",(0,i.jsx)(n.code,{children:".mjs"})," and ",(0,i.jsx)(n.code,{children:"cjs"})," as implicit file extensions, so they are not included here by default, but can be included by changing this configuration:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When building CommonJS/ESM artifacts, inject some polyfill code such as ",(0,i.jsx)(n.code,{children:"__dirname"})," which can only be used in CommonJS.\nAfter enable this option, it will compile ",(0,i.jsx)(n.code,{children:"__dirname"})," as ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"})," when format is esm."]}),"\n",(0,i.jsxs)(n.p,{children:["See details ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"here"}),",\nNote that esm shims will only be injected if ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," is node, because the url module is used."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Module sideEffects"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Normally, we configure the module's side effects via the sideEffects field in package.json, but in some cases, The package.json of a third-party package is unreliable.Such as when we reference a third-party package style file"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsx)(n.p,{children:"But the package.json of this third-party package does not have the style file configured in the sideEffects"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At the same time you set ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," to ",(0,i.jsx)(n.code,{children:"true"})," and you will see a warning message like this in the console"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, you can use this configuration option to manually configure the module's ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," to support regular and functional forms."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"After adding this configuration, the sideEffects field in package.json will no longer be read when packaging"})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the source directory of the build, default is ",(0,i.jsx)(n.code,{children:"src"}),", which is used to generate the corresponding output directory based on the source directory structure when building ",(0,i.jsx)(n.code,{children:"bundleless"}),".\nSame as ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to generate sourceMap or not"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Sets the format of the source code. By default, the source code will be treated as EsModule. When the source code is using CommonJS, you need to set ",(0,i.jsx)(n.code,{children:"commonjs"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Whether to enable code splitting.\nOnly support ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," and ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),",see ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"})," learn more."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure style-related configuration"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less-related configuration"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Refer to ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"})," for detailed configuration"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Add ",(0,i.jsx)(n.code,{children:"Less"})," code to the beginning of the entry file."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Configure the implementation library used by ",(0,i.jsx)(n.code,{children:"Less"}),", if not specified, the built-in version used is ",(0,i.jsx)(n.code,{children:"4.1.3"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the implementation library for ",(0,i.jsx)(n.code,{children:"Less"})," when the ",(0,i.jsx)(n.code,{children:"object"})," type is specified."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the ",(0,i.jsx)(n.code,{children:"string"})," type, specify the path to the implementation library for ",(0,i.jsx)(n.code,{children:"Less"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesass",children:["style.sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"sass-related configuration."}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Refer to ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})," for detailed configuration."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Add ",(0,i.jsx)(n.code,{children:"Sass"})," code to the beginning of the entry file."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Configure the implementation library used by ",(0,i.jsx)(n.code,{children:"Sass"}),", the built-in version used is ",(0,i.jsx)(n.code,{children:"1.5.4"})," if not specified."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the implementation library for ",(0,i.jsx)(n.code,{children:"Sass"})," when the ",(0,i.jsx)(n.code,{children:"object"})," type is specified."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the ",(0,i.jsx)(n.code,{children:"string"})," type, specify the path to the ",(0,i.jsx)(n.code,{children:"Sass"})," implementation library"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to configure options for PostCSS. The provided values will be merged with the default configuration using ",(0,i.jsx)(n.code,{children:"Object.assign"}),". Note that ",(0,i.jsx)(n.code,{children:"Object.assign"})," performs a shallow copy, so it will completely override the built-in ",(0,i.jsx)(n.code,{children:"plugins"})," array."]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed configuration, please refer to ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // The following plugins are enabled by default\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // The following plugins are only enabled when the target is `es5`\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure whether to insert CSS styles into JavaScript code in bundle mode."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Set ",(0,i.jsx)(n.code,{children:"inject"})," to ",(0,i.jsx)(n.code,{children:"true"})," to enable this feature:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"Once enabled, you will see the CSS code referenced in the source code included in the bundled JavaScript output."}),"\n",(0,i.jsxs)(n.p,{children:["For example, if you write ",(0,i.jsx)(n.code,{children:"import './index.scss'"})," in the source code, you will see the following code in the output:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["After enabling ",(0,i.jsx)(n.code,{children:"inject"}),", you need to pay attention to the following points:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"@import"})," in CSS files will not be processed. If your CSS file contains ",(0,i.jsx)(n.code,{children:"@import"}),", you need to manually import the CSS file in the JS file (less and scss files are not required because they have preprocessing)."]}),"\n",(0,i.jsxs)(n.li,{children:["Consider the impact of ",(0,i.jsx)(n.code,{children:"sideEffects"}),". By default, our builder assumes that CSS has side effects. If the ",(0,i.jsx)(n.code,{children:"sideEffects"})," field is set in your project or third-party package's package.json and does not include this CSS file, you will receive a warning:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["You can resolve this by configuring ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"}),"."]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Enable CSS Modules automatically based on the filename."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : Enables CSS Modules for style files ending with ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," filenames"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : Disable CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : Enables CSS Modules for all files that match the regular condition."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules configuration"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["A common configuration is ",(0,i.jsx)(n.code,{children:"localsConvention"}),", which changes the class name generation rules for css modules"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"For the following styles"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["You can use ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," to access"]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed configuration see ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to modify the configuration of ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"enabling-tailwind-css",children:["Enabling Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#enabling-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Before using ",(0,i.jsx)(n.code,{children:"style.tailwindcss"}),", you need to enable the Tailwind CSS plugin for Modern.js Module."]}),"\n",(0,i.jsxs)(n.p,{children:["Please refer to the section ",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss.html",children:"Using Tailwind CSS"})," for instructions on how to enable it."]}),"\n",(0,i.jsxs)(n.h3,{id:"type",children:["Type",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#type",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When the value is of type ",(0,i.jsx)(n.code,{children:"object"}),", it is merged with the default configuration via ",(0,i.jsx)(n.code,{children:"Object.assign"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["When the value is of type ",(0,i.jsx)(n.code,{children:"Function"}),", the object returned by the function is merged with the default configuration via ",(0,i.jsx)(n.code,{children:"Object.assign"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The rest of the usage is the same as Tailwind CSS: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Quick Portal"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"notes",children:["Notes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#notes",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Please note that:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If you are using both the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file and ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," option, the configuration defined in ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," will take precedence and override the content defined in ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["If you are using the ",(0,i.jsx)(n.code,{children:"designSystem"})," configuration option simultaneously, the ",(0,i.jsx)(n.code,{children:"theme"})," configuration of Tailwind CSS will be overridden by the value of ",(0,i.jsx)(n.code,{children:"designSystem"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The usage of other configurations follows the same approach as the official usage of Tailwind CSS. Please refer to ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"})," for more details."]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," is used to set the target environment for the generated JavaScript code. It enables Modern.js Module to transform JavaScript syntax that is not recognized by the target environment into older versions of JavaScript syntax that are compatible with these environments."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, compile the code to ",(0,i.jsx)(n.code,{children:"es5"})," syntax:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Using ",(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," provides the same ability and configuration as ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"babel-plugin-import"})}),".\nWith this configuration, the code will be converted using SWC."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The elements of the array are configuration objects for ",(0,i.jsx)(n.code,{children:"babel-plugin-import"}),", which can be referred to ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Example:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import`s options config\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Reference the ",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import.html#notes",children:"Import Plugin - Notes"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Specifies whether to modularize the import of ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," and remove unused lodash modules to reduce the code size of lodash."]}),"\n",(0,i.jsxs)(n.p,{children:["This optimization is implemented using ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," under the hood."]}),"\n",(0,i.jsx)(n.p,{children:"With this configuration, the code will be converted using SWC."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When you enable this, Modern.js Module will automatically redirects the code references of ",(0,i.jsx)(n.code,{children:"lodash"})," to sub-paths."]}),"\n",(0,i.jsx)(n.p,{children:"For example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"The transformed code will be:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Path to the tsconfig file"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify global variables for external import of umd artifacts"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, ",(0,i.jsx)(n.code,{children:"react"})," and ",(0,i.jsx)(n.code,{children:"react-dom"})," will be seen as global variables imported externally and will not be packed into the umd product, but will be accessible by way of ",(0,i.jsx)(n.code,{children:"global.React"})," and ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the module name of the umd product"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"export default {\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point the umd artifact will go to mount on ",(0,i.jsx)(n.code,{children:"global.myLib"})]}),"\n",(0,i.jsx)(n.p,{children:":::tip"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"The module name of the umd artifact must not conflict with the global variable name."}),"\n",(0,i.jsxs)(n.li,{children:["Module names will be converted to camelCase, e.g. ",(0,i.jsx)(n.code,{children:"my-lib"})," will be converted to ",(0,i.jsx)(n.code,{children:"myLib"}),", refer to ",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),".\n:::"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Also the function form can take one parameter, which is the output path of the current package file"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n};\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}let d=l;l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.alias",id:"resolvealias",depth:3},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"style.sass",id:"stylesass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3},{text:"Type",id:"type",depth:3},{text:"Notes",id:"notes",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file +"use strict";(self.webpackChunk_modern_js_module_tools_docs=self.webpackChunk_modern_js_module_tools_docs||[]).push([["5864"],{8051:function(e,n,s){s.r(n),s.d(n,{default:function(){return d}});var i=s(9980),r=s(9580);function t(e){let n=Object.assign({h1:"h1",a:"a",p:"p",code:"code",ul:"ul",li:"li",strong:"strong",div:"div",h2:"h2",pre:"pre",blockquote:"blockquote",ol:"ol",h3:"h3"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.h1,{id:"buildconfig",children:["buildConfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildconfig",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"buildConfig"})," is a configuration option that describes how to compile and generate build artifacts. It contains all the configurations related to the build process."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object | object[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["Before start using ",(0,i.jsx)(n.code,{children:"buildConfig"}),", please read the following documentation to understand its purpose:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/basic/modify-output-product.html",children:"Modifying Output Artifacts"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html",children:"In-Depth Understanding of the Build Process"})}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"alias",children:["alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#alias",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{'@': 'src',}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["For TypeScript projects, you only need to configure ",(0,i.jsx)(n.a,{href:"https://www.typescriptlang.org/tsconfig#paths",target:"_blank",rel:"noopener noreferrer",children:"compilerOptions.paths"})," in ",(0,i.jsx)(n.code,{children:"tsconfig.json"}),", Modern.js Module will automatically recognize the alias in ",(0,i.jsx)(n.code,{children:"tsconfig.json"}),", so there is no need to configure the ",(0,i.jsx)(n.code,{children:"alias"})," field additionally.\n"]})})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: {\n '@common': '. /src/common',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After the above configuration is done, if ",(0,i.jsx)(n.code,{children:"@common/Foo.tsx"})," is referenced in the code, it will map to the ",(0,i.jsx)(n.code,{children:"/src/common/Foo.tsx"})," path."]}),"\n",(0,i.jsxs)(n.p,{children:["When the value of ",(0,i.jsx)(n.code,{children:"alias"})," is defined as a function, you can accept the pre-defined alias object and modify it."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: alias => {\n alias['@common'] = '. /src/common';\n },\n },\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"It is also possible to return a new object as the final result in the function, which will override the pre-defined alias object."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n alias: alias => {\n return {\n '@common': '. /src/common',\n };\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"asset",children:["asset",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#asset",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Contains configuration related to static assets."}),"\n",(0,i.jsxs)(n.h2,{id:"assetname",children:["asset.name",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetname",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Static resource output file name."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | ((assetPath) => name)"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[name].[hash].[ext]"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When asset.name is a string, it will automatically replace [name], [ext], and [hash], respectively replaced by the file name, extension, and file hash."}),"\n",(0,i.jsx)(n.p,{children:"Also you can use asset.name as a function, and the return is output asset name. At this time, this function receives a parameter assetPath, which corresponds to the resource path."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n // no hash\n name: [name].[ext],\n // any logic\n // name: (assetPath) => 'any.png',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetlimit",children:["asset.limit",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetlimit",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Used to set the threshold for static assets to be automatically inlined as base64."}),"\n",(0,i.jsx)(n.p,{children:"By default, Modern.js Module will inline assets such as images, fonts and media smaller than 10KB during bundling. They are Base64 encoded and inlined in the bundles, eliminating the need for separate HTTP requests."}),"\n",(0,i.jsxs)(n.p,{children:["You can adjust this threshold by modifying the ",(0,i.jsx)(n.code,{children:"limit"})," config."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"number"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"10 * 1024"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, set ",(0,i.jsx)(n.code,{children:"limit"})," to ",(0,i.jsx)(n.code,{children:"0"})," to avoid assets inlining:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n asset: {\n limit: 0,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetpath",children:["asset.path",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Static resource output path, will be based on ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"assets"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetpublicpath",children:["asset.publicPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetpublicpath",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"The CDN prefix given to unlinked assets when bundling."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n asset: {\n publicPath: 'https://xxx/',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, all static assets will be prefixed with ",(0,i.jsx)(n.code,{children:"https://xxx/"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgr",children:["asset.svgr",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgr",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Packaged to handle svg as a React component, options reference ",(0,i.jsx)(n.a,{href:"https://react-svgr.com/docs/options/",target:"_blank",rel:"noopener noreferrer",children:"svgr"}),", plus support for two configuration options ",(0,i.jsx)(n.code,{children:"include"})," and ",(0,i.jsx)(n.code,{children:"exclude"})," to match the svg file to be handled"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When svgr feature is enabled, you can use svg as a component using the default export."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"// true\nimport Logo from './logo.svg';\n\nexport default () => ;\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive ",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["When enabled, the type of svg used can be modified by initing a new declaration file and adding to the ",(0,i.jsx)(n.code,{children:"modern-app-env.d.ts"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="your-app-env.d.ts"',children:"declare module '*.svg' {\n const src: React.FunctionComponent>;\n export default src;\n}\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern-app-env.d.ts"',children:"/// \n/// \n"})}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrinclude",children:["asset.svgr.include",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrinclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Set the matching svg file"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"/\\.svg$/"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexclude",children:["asset.svgr.exclude",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexclude",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Set unmatched svg files"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | RegExp | (string | RegExp)[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"assetsvgrexporttype",children:["asset.svgr.exportType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#assetsvgrexporttype",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Used to configure the SVG export type when using SVGR."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'named' | 'default'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"default"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"when it is 'named', use the following syntax:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="index.ts"',children:"import { ReactComponent } from './logo.svg';\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The named export defaults to ",(0,i.jsx)(n.code,{children:"ReactComponent"}),", and can be customized with the ",(0,i.jsx)(n.code,{children:"asset.svgr.namedExport"}),"."]}),"\n",(0,i.jsxs)(n.h2,{id:"autoextension",children:["autoExtension",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoextension",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Suffixes for js files and type description files in automation based on ",(0,i.jsx)(n.a,{href:"#format",children:"format"})," and ",(0,i.jsx)(n.a,{href:"https://nodejs.org/api/packages.html#type",target:"_blank",rel:"noopener noreferrer",children:"type"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When disabled, js artifacts are suffixed with ",(0,i.jsx)(n.code,{children:".js"})," and type description files are suffixed with ",(0,i.jsx)(n.code,{children:"d.ts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["When enabled, node loads ",(0,i.jsx)(n.code,{children:".js"})," as esm by default when type is ",(0,i.jsx)(n.code,{children:"module"}),", so when we want to output cjs artifacts, the js product is suffixed with ",(0,i.jsx)(n.code,{children:".cjs"})," and the type description file is suffixed with ",(0,i.jsx)(n.code,{children:"d.cts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["On the other hand, if the type field is missing or the type is ",(0,i.jsx)(n.code,{children:"commonjs"}),", node loads the ",(0,i.jsx)(n.code,{children:".js"})," file as cjs by default.\nSo when we want to output esm output, the js output is suffixed with ",(0,i.jsx)(n.code,{children:".mjs"})," and the type description file is suffixed with ",(0,i.jsx)(n.code,{children:"d.mts"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:[":::warning\nWhen used in bundleless mode, we have an extra step of processing the import/export statement in each file. We will suffix the relative path to the js file, possibly ",(0,i.jsx)(n.code,{children:".mjs"})," or ",(0,i.jsx)(n.code,{children:".cjs"}),", depending on your package configuration.\nYou can disable this step by ",(0,i.jsx)(n.a,{href:"#redirect",children:"redirect.autoExtension"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["Notice ",(0,i.jsx)(n.a,{href:"https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md#nouselessindex",target:"_blank",rel:"noopener noreferrer",children:"noUselessIndex"})," will break this behavior, you should disable it.\nIf you need to use this configuration in bundleless, please patch the ",(0,i.jsx)(n.code,{children:"index"}),", e.g. if utils is a folder, you need to rewrite ",(0,i.jsx)(n.code,{children:"import * from './utils'"})," to ",(0,i.jsx)(n.code,{children:"import * from './utils/index'"}),"\n"]})]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExtension: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternal",children:["autoExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternal",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Automatically externalize project dependencies and peerDependencies and not package them into the final bundle"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"When we want to turn off the default handling behavior for third-party dependencies, we can do so by:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: false,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["This way the dependencies under ",(0,i.jsx)(n.code,{children:'"dependencies"'})," and ",(0,i.jsx)(n.code,{children:'"peerDependencies"'})," will be bundled. If you want to turn off the processing of only one of these dependencies, you can use the\n",(0,i.jsx)(n.code,{children:"buildConfig.autoExternal"})," in the form of an object."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n autoExternal: {\n dependencies: false,\n peerDependencies: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternaldependencies",children:["autoExternal.dependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternaldependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether or not the dep dependencies of the external project are needed"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"autoexternalpeerdependencies",children:["autoExternal.peerDependencies",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#autoexternalpeerdependencies",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to require peerDep dependencies for external projects"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"banner",children:["banner",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#banner",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Provides the ability to inject content into the top and bottom of each JS , CSS and DTS file."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface BannerAndFooter {\n js?: string;\n css?: string;\n dts?: string;\n}\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"BannerAndFooter"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Let's say you want to add copyright information to JS and CSS files."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"import { moduleTools, defineConfig } from '@edenx/module-tools';\n\nconst copyRight = `/*\n \xa9 Copyright 2020 example.com or one of its affiliates.\n * Some Sample Copyright Text Line\n * Some Sample Copyright Text Line\n*/`;\n\nexport default defineConfig({\n plugins: [moduleTools()],\n buildConfig: {\n banner: {\n js: copyRight,\n css: copyRight,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"buildtype",children:["buildType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#buildtype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The build type, ",(0,i.jsx)(n.code,{children:"bundle"})," will package your code, ",(0,i.jsx)(n.code,{children:"bundleless"})," will only do the code conversion"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'bundle' | 'bundleless'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"copy",children:["copy",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copy",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Copies the specified file or directory into the build output directory"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"export default {\n buildConfig: {\n copy: [{ from: '. /src/assets', to: '' }],\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Reference for array settings: ",(0,i.jsx)(n.a,{href:"https://github.com/webpack-contrib/copy-webpack-plugin#patterns",target:"_blank",rel:"noopener noreferrer",children:"copy-webpack-plugin patterns"})]}),"\n",(0,i.jsxs)(n.h2,{id:"copypatterns",children:["copy.patterns",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copypatterns",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"CopyPattern[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"interface CopyPattern {\n from: string;\n to?: string;\n context?: string;\n globOptions?: globby.GlobbyOptions;\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"copyoptions",children:["copy.options",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#copyoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Options = {\n concurrency?: number;\n enableCopySync?: boolean;\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{ concurrency: 100, enableCopySync: false }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"concurrency"}),": Specifies how many copy tasks to execute in parallel."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"enableCopySync"}),": Uses ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy-sync.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copySync"})})," by default, instead of ",(0,i.jsx)(n.a,{href:"https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy/copy.js",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"fs.copy"})}),"."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"define",children:["define",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#define",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Define global variables that will be injected into the code"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Since the ",(0,i.jsx)(n.code,{children:"define"})," function is implemented by global text replacement, you need to ensure that the global variable values are strings. A safer approach is to convert the value of each global variable to a string, as follows."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive info",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"INFO"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"Modern.js automatically performs JSON serialization handling internally, so manual serialization is not required."}),"\n",(0,i.jsxs)(n.p,{children:["If automatic serialization is not needed, you can define ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#alias",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"alias"})})," using ",(0,i.jsx)(n.a,{href:"/api/config/build-config.html#esbuildoptions",children:(0,i.jsx)(n.code,{children:"esbuildOptions"})})," configuration."]}),"\n"]})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n define: {\n VERSION: require('./package.json').version || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["If the project is a TypeScript project, then you may need to add the following to the ",(0,i.jsx)(n.code,{children:".d.ts"})," file in the project source directory."]}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["If the ",(0,i.jsx)(n.code,{children:".d.ts"})," file does not exist, then you can create it manually."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="env.d.ts"',children:"declare const YOUR_ADD_GLOBAL_VAR;\n"})}),"\n",(0,i.jsx)(n.p,{children:"You can also replace environment variable:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import { defineConfig } from '@modern-js/module-tools';\nexport default defineConfig({\n buildConfig: {\n define: {\n 'process.env.VERSION': process.env.VERSION || '0.0.0',\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"With the above configuration, we can put the following code."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// pre-compiler code\nconsole.log(process.env.VERSION);\n"})}),"\n",(0,i.jsxs)(n.p,{children:["When executing ",(0,i.jsx)(n.code,{children:"VERSION=1.0.0 modern build"}),", the conversion is:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"// compiled code\nconsole.log('1.0.0');\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"To prevent excessive global replacement substitution, it is recommended that the following two principles be followed when using"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"Use upper case for global constants"}),"\n",(0,i.jsx)(n.li,{children:"Customize the prefix and suffix of global constants to ensure uniqueness"}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"dts",children:["dts",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dts",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"The dts file generates the relevant configuration, by default it generates."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"{\n abortOnError: true,\n distPath: './',\n only: false,\n}\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsabortonerror",children:["dts.abortOnError",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsabortonerror",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to allow the build to succeed if a type error occurs."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"By default, type errors will cause the build to fail"}),". When ",(0,i.jsx)(n.code,{children:"abortOnError"})," is set to ",(0,i.jsx)(n.code,{children:"false"}),", the build will still succeed even if there are type issues in the code:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n abortOnError: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:["When this configuration is disabled, there is no guarantee that the type files will be generated correctly. In ",(0,i.jsx)(n.code,{children:"buildType: 'bundle'"}),", which is the bundle mode, type files will not be generated.\n"]})})]}),"\n",(0,i.jsxs)(n.h2,{id:"dtsdistpath",children:["dts.distPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsdistpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The output path of the dts file, based on ",(0,i.jsx)(n.a,{href:"/api/config/build-config#outdir",children:"outDir"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"./"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, output to the ",(0,i.jsx)(n.code,{children:"types"})," directory under the ",(0,i.jsx)(n.code,{children:"outDir"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n distPath: './types',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsenabletscbuild",children:["dts.enableTscBuild",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsenabletscbuild",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Enable the tsc '--build' option. When using project reference,\nyou can use the '--build' option to achieve cooperation between projects and speed up the build speed."}),"\n",(0,i.jsx)(n.p,{children:"This option requires version > 2.43.0,In fact,\nwe experimentally enabled this option in the 2.42.0 version, but the many problems it brought forced us to enable it dynamically."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-warning",children:"When this option is enabled, to meet the build requirements, you must explicitly set 'declarationDir' or 'outDir' in tsconfig.json,\nIf you are not using TS >= 5.0 version, you also need to explicitly set 'declaration' and 'emitDeclarationOnly'.\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">2.43.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n enableTscBuild: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsonly",children:["dts.only",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsonly",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to generate only type files during the build process without generating JavaScript output files."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n only: true,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtstsconfigpath",children:["dts.tsconfigPath",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtstsconfigpath",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"deprecated"}),",use ",(0,i.jsx)(n.a,{href:"#tsconfig",children:"tsconfig"})," instead."]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the path to the tsconfig file used to generate the type file."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n tsconfigPath: './other-tsconfig.json',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"dtsrespectexternal",children:["dts.respectExternal",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#dtsrespectexternal",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When set to ",(0,i.jsx)(n.code,{children:"false"}),", the type of third-party packages will be excluded from the bundle, when set to ",(0,i.jsx)(n.code,{children:"true"}),", it will determine whether third-party types need to be bundled based on ",(0,i.jsx)(n.a,{href:"#externals",children:"externals"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"When bundle d.ts, export is not analyzed, so any third-party package type you use may break your build, which is obviously uncontrollable.\nSo we can avoid it with this configuration."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n dts: {\n respectExternal: false,\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"esbuildoptions",children:["esbuildOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#esbuildoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to modify the ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/",target:"_blank",rel:"noopener noreferrer",children:"esbuild configuration"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"c => c"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"For example, if we need to modify the file extension of the generated files:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.outExtension = { '.js': '.mjs' };\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"For example, register an esbuild plugin:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"import { myEsbuildPlugin } from './myEsbuildPlugin';\n\nexport default defineConfig({\n buildConfig: {\n esbuildOptions: options => {\n options.plugins = [myEsbuildPlugin, ...options.plugins];\n return options;\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"When adding an esbuild plugin, please note that you need to add the plugin at the beginning of the plugins array. This is because the Modern.js Module is also integrated into the entire build process through an esbuild plugin. Therefore, custom plugins need to be registered with higher priority."}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsx)(n.p,{children:"We have done many extensions based on the original esbuild build. Therefore, when using this configuration, pay attention to the following:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["Prefer to use the configuration that Modern.js Module provides. For example, esbuild does not support ",(0,i.jsx)(n.code,{children:"target: 'es5'"}),", but we support this scenario internally using SWC. Setting ",(0,i.jsx)(n.code,{children:"target: 'es5'"})," through esbuildOptions will result in an error."]}),"\n",(0,i.jsx)(n.li,{children:"Currently, we use enhanced-resolve internally to replace esbuild's resolve algorithm, so modifying esbuild resolve-related configurations is invalid. We plan to switch back in the future."}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"externalhelpers",children:["externalHelpers",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externalhelpers",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"By default, the output JS code may depend on helper functions to support the target environment or output format, and these helper functions will be inlined in the file that requires it."}),"\n",(0,i.jsxs)(n.p,{children:["With this configuration, the code will be converted using SWC, it will inline helper functions to import them from the external module ",(0,i.jsx)(n.code,{children:"@swc/helpers"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Below is a comparison of the output file changes before and after using this configuration."}),"\n",(0,i.jsx)(n.p,{children:"Before enable:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// helper function\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n // ...\n}\n// helper function\nfunction _async_to_generator(fn) {\n return function () {\n // use asyncGeneratorStep\n // ...\n };\n}\n\n// your code\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"After enabled:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="./dist/index.js"',children:"// helper functions imported from @swc/helpers\nimport { _ as _async_to_generator } from '@swc/helpers/_/_async_to_generator';\n\n// your code\nexport var yourCode = function () {\n // use _async_to_generator\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"externals",children:["externals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#externals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure external dependencies that will not be bundled into the final bundle."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type External = (string | RegExp)[];\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n // do not bundle React\n externals: ['react'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"footer",children:["footer",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#footer",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Same as the ",(0,i.jsx)(n.a,{href:"#banner",children:"banner"})," configuration for adding a comment at the end of the output file."]}),"\n",(0,i.jsxs)(n.h2,{id:"format",children:["format",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to set the output format of JavaScript files. The options ",(0,i.jsx)(n.code,{children:"iife"})," and ",(0,i.jsx)(n.code,{children:"umd"})," only take effect when ",(0,i.jsx)(n.code,{children:"buildType"})," is ",(0,i.jsx)(n.code,{children:"bundle"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'esm' | 'cjs' | 'iife' | 'umd'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"cjs"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h3,{id:"format-esm",children:["format: esm",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-esm",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"esm"}),' stands for "ECMAScript module" and requires the runtime environment to support import and export syntax.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-cjs",children:["format: cjs",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-cjs",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"cjs"}),' stands for "CommonJS" and requires the runtime environment to support exports, require, and module syntax. This format is commonly used in Node.js environments.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'cjs',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-iife",children:["format: iife",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-iife",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"iife"}),' stands for "immediately-invoked function expression" and wraps the code in a function expression to ensure that any variables in the code do not accidentally conflict with variables in the global scope. This format is commonly used in browser environments.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'iife',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"format-umd",children:["format: umd",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#format-umd",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"umd"}),' stands for "Universal Module Definition" and is used to run modules in different environments such as browsers and Node.js. Modules in UMD format can be used in various environments, either as global variables or loaded as modules using module loaders like RequireJS.']}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'umd',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"hooks",children:["hooks",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#hooks",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Build lifecycle hooks that allow custom logic to be injected at specific stages of the build process."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Types"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type HookList = {\n name: string;\n apply: (compiler: ICompiler) => void.\n}\n\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["We can get the compiler instance in the apply method, modify its properties, and execute custom logic at different stages. For more information on Hooks, see [Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in the Build Process]).\nFor more information on Hooks, see ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build.html#using-hooks-to-intervene-in-the-build-process",children:"Using-hooks-to-intervene-in-the-build-process"}),"."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n hooks: [\n {\n name: 'renderChunk',\n apply: compiler => {\n // any logic for compiler\n compiler.hooks.renderChunk.tapPromise(\n { name: 'renderChunk' },\n async chunk => {\n return chunk;\n },\n );\n },\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"input",children:["input",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#input",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify the entry file for the build, in the form of an array that can specify the directory"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Input =\n | string[];\n | {\n [name: string]: string;\n }\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"['src/index.ts']"})," in ",(0,i.jsx)(n.code,{children:"bundle"})," mode, ",(0,i.jsx)(n.code,{children:"['src']"})," in ",(0,i.jsx)(n.code,{children:"bundleless"})," mode"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Array usage:"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundle"})," mode, the following configurations will be built using ",(0,i.jsx)(n.code,{children:"src/index.ts"})," and ",(0,i.jsx)(n.code,{children:"src/index2.ts"})," as entry points. The ",(0,i.jsx)(n.code,{children:"bundle"})," mode does not support configuring ",(0,i.jsx)(n.code,{children:"input"})," as a directory."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n buildType: 'bundle',\n input: ['src/index.ts', 'src/index2.ts'],\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundleless"})," mode, the following configuration compiles both files in the ",(0,i.jsx)(n.code,{children:"src/a"})," directory and ",(0,i.jsx)(n.code,{children:"src/index.ts"})," file."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src/a', 'src/index.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.code,{children:"bundleless"})," mode, ",(0,i.jsx)(n.strong,{children:"Array usage"})," also supports the usage of ",(0,i.jsx)(n.code,{children:"!"})," to filter partial files:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundleless',\n input: ['src', '!src/*.spec.ts'],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The above configuration will build the files in the ",(0,i.jsx)(n.code,{children:"src"})," directory, and will also filter files with the ",(0,i.jsx)(n.code,{children:"spec.ts"})," suffix.This is useful in cases where the test files are in the same root directory as the source files."]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Object usage:"})}),"\n",(0,i.jsx)(n.p,{children:"When you need to modify the output file name in bundle mode, you can use an object configuration."}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"The key of the object is the file name of the output, and the value is the file path of the source code."})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n format: 'esm',\n input: {\n 'index.esm': './src/index.ts',\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"jsx",children:["jsx",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#jsx",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify the compilation method for JSX, which by default supports React 17 and higher versions and automatically injects JSX runtime code."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"automatic | transform"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"automatic"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["If you need to support React 16, you can set ",(0,i.jsx)(n.code,{children:"jsx"})," to ",(0,i.jsx)(n.code,{children:"transform"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n jsx: 'transform',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:[(0,i.jsxs)(n.p,{children:["If you don't need to convert JSX, you can set ",(0,i.jsx)(n.code,{children:"jsx"})," to ",(0,i.jsx)(n.code,{children:"preserve"}),", but don't ",(0,i.jsx)(n.a,{href:"/guide/advance/in-depth-about-build#use-swc",children:"use swc"})," to do the code conversion.\nFor more information about JSX Transform, you can refer to the following links:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html",target:"_blank",rel:"noopener noreferrer",children:"React Blog - Introducing the New JSX Transform"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#jsx",target:"_blank",rel:"noopener noreferrer",children:"esbuild - JSX"}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"metafile",children:["metafile",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#metafile",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"This option is used for build analysis. When enabled, esbuild will generate metadata about the build in JSON format."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Build Type"}),": ",(0,i.jsx)(n.code,{children:"Only supported for buildType: 'bundle'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["To enable ",(0,i.jsx)(n.code,{children:"metafile"})," generation:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n buildType: 'bundle',\n metafile: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["After executing the build, a ",(0,i.jsx)(n.code,{children:"metafile-[xxx].json"})," file will be generated in the output directory. You can use tools like ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/analyze/",target:"_blank",rel:"noopener noreferrer",children:"esbuild analyze"})," and ",(0,i.jsx)(n.a,{href:"https://bundle-buddy.com/esbuild",target:"_blank",rel:"noopener noreferrer",children:"bundle-buddy"})," for visual analysis."]}),"\n",(0,i.jsxs)(n.h2,{id:"minify",children:["minify",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#minify",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Use esbuild or terser to compress code, also pass ",(0,i.jsx)(n.a,{href:"https://github.com/terser/terser#minify-options",target:"_blank",rel:"noopener noreferrer",children:"terserOptions"})]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'terser' | 'esbuild' | false | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n minify: {\n compress: {\n drop_console: true,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"outdir",children:["outDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#outdir",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the output directory of the build."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"./dist"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n outDir: './dist/esm',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"platform",children:["platform",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#platform",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Generates code for the node environment by default, you can also specify ",(0,i.jsx)(n.code,{children:"browser"})," which will generate code for the browser environment.\nSee ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#platform",target:"_blank",rel:"noopener noreferrer",children:"esbuild.platform"})," learn more."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'browser' | 'node'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'node'"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n platform: 'browser',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"redirect",children:["redirect",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#redirect",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["In ",(0,i.jsx)(n.strong,{children:(0,i.jsx)(n.code,{children:"buildType: 'bundleless'"})})," build mode, the reference path is redirected to ensure that it points to the correct product, e.g:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import '. /index.less'"})," will be rewritten to ",(0,i.jsx)(n.code,{children:"import '. /index.css'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import icon from '. /close.svg'"})," would be rewritten as ",(0,i.jsx)(n.code,{children:"import icon from '... /asset/close.svg'"})," to ",(0,i.jsx)(n.code,{children:"import icon from '. /asset/close.svg'"})," (depending on the situation)"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"import * from './utils'"})," will be rewritten to ",(0,i.jsx)(n.code,{children:"import * from './utils.mjs'"})," (if generate utils.mjs, depending on the situation)"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"In some scenarios, you may not need these functions, then you can turn it off with this configuration, and its reference path will not be changed after turning it off."}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n redirect: {\n alias: false, // Turn off modifying alias paths\n style: false, // Turn off modifying the path to the style file\n asset: false, // Turn off modifying the path to the asset\n autoExtension: false, // Turn off modifying the suffix to the js file\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"resolve",children:["resolve",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolve",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Custom module resolution options"}),"\n",(0,i.jsxs)(n.h3,{id:"resolvealias",children:["resolve.alias",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvealias",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["The basic usage is the same as ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The issue with ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"})," is that we incorrectly handled Module IDs in a bundleless scenario:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "react";\n'})}),"\n",(0,i.jsxs)(n.p,{children:["When we configure alias: ",(0,i.jsx)(n.code,{children:"{ react: 'react-native' }"}),", the result becomes:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:'import { createElement } from "./react-native";\n'})}),"\n",(0,i.jsx)(n.p,{children:"A Module ID is incorrectly processed as a relative path, which is not expected."}),"\n",(0,i.jsx)(n.p,{children:"We want to fix this issue, but it may break existing projects."}),"\n",(0,i.jsxs)(n.p,{children:["Therefore, in ",(0,i.jsx)(n.strong,{children:"2.58.0"}),", we provided ",(0,i.jsx)(n.code,{children:"resolve.alias"})," to solve this problem. Additionally, ",(0,i.jsx)(n.code,{children:"resolve.alias"})," removed the default value ",(0,i.jsx)(n.code,{children:'{ "@": "./src"}'})," provided by ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["If you need this feature, please use ",(0,i.jsx)(n.code,{children:"resolve.alias"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["In the next major version, ",(0,i.jsx)(n.code,{children:"resolve.alias"})," will replace ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Note that this configuration should not be mixed with ",(0,i.jsx)(n.a,{href:"#alias",children:"alias"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["Ensure that this configuration specifies a relative path, such as ",(0,i.jsx)(n.code,{children:'{ "@": "./src" }'})," rather than ",(0,i.jsx)(n.code,{children:'{ "@": "src"}'}),"."]}),"\n"]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvemainfields",children:["resolve.mainFields",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvemainfields",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"A list of fields in package.json to try when parsing the package entry point."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": depends on ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"node: ['module', 'main']"}),"\n",(0,i.jsx)(n.li,{children:"browser: ['module', 'browser', 'main']"}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, we want to load the ",(0,i.jsx)(n.code,{children:"js:source"})," field first:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n mainFields: ['js:source', 'module', 'main'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive warning",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"WARNING"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"resolve.mainFields"})," has a lower priority than the exports field in package.json, and if an entry point is successfully resolved from exports, ",(0,i.jsx)(n.code,{children:"resolve.mainFields"})," will be ignored.\n"]})})]}),"\n",(0,i.jsxs)(n.h3,{id:"resolvejsextentions",children:["resolve.jsExtentions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#resolvejsextentions",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Support for implicit file extensions"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"['.jsx', '.tsx', '.js', '.ts', '.json']"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Do not use implicit file extensions for css files, currently Module only supports ['.less', '.css', '.sass', '.scss'] suffixes."}),"\n",(0,i.jsxs)(n.p,{children:["Node's parsing algorithm does not consider ",(0,i.jsx)(n.code,{children:".mjs"})," and ",(0,i.jsx)(n.code,{children:"cjs"})," as implicit file extensions, so they are not included here by default, but can be included by changing this configuration:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n resolve: {\n jsExtentions: ['.mts', 'ts'],\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"shims",children:["shims",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#shims",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When building CommonJS/ESM artifacts, inject some polyfill code such as ",(0,i.jsx)(n.code,{children:"__dirname"})," which can only be used in CommonJS.\nAfter enable this option, it will compile ",(0,i.jsx)(n.code,{children:"__dirname"})," as ",(0,i.jsx)(n.code,{children:"path.dirname(fileURLToPath(import.meta.url))"})," when format is esm."]}),"\n",(0,i.jsxs)(n.p,{children:["See details ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/shims",target:"_blank",rel:"noopener noreferrer",children:"here"}),",\nNote that esm shims will only be injected if ",(0,i.jsx)(n.a,{href:"#platform",children:"platform"})," is node, because the url module is used."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.38.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n shims: true,\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"sideeffects",children:["sideEffects",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sideeffects",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Module sideEffects"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Normally, we configure the module's side effects via the sideEffects field in package.json, but in some cases, The package.json of a third-party package is unreliable.Such as when we reference a third-party package style file"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"import 'other-package/dist/index.css';\n"})}),"\n",(0,i.jsx)(n.p,{children:"But the package.json of this third-party package does not have the style file configured in the sideEffects"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",meta:'title="other-package/package.json"',children:'{\n "sideEffects": ["dist/index.js"]\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At the same time you set ",(0,i.jsx)(n.a,{href:"#styleinject",children:"style.inject"})," to ",(0,i.jsx)(n.code,{children:"true"})," and you will see a warning message like this in the console"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-bash",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "other-package/dist/index.css" was marked as having no side effects\n'})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, you can use this configuration option to manually configure the module's ",(0,i.jsx)(n.code,{children:'"sideEffects"'})," to support regular and functional forms."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n sideEffects: [/\\.css$/],\n // or\n // sideEffects: (filePath, isExternal) => /\\.css$/.test(filePath),\n },\n});\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsx)(n.div,{className:"rspress-directive-content",children:(0,i.jsx)(n.p,{children:"After adding this configuration, the sideEffects field in package.json will no longer be read when packaging"})})]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcedir",children:["sourceDir",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcedir",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the source directory of the build, default is ",(0,i.jsx)(n.code,{children:"src"}),", which is used to generate the corresponding output directory based on the source directory structure when building ",(0,i.jsx)(n.code,{children:"bundleless"}),".\nSame as ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#outbase",target:"_blank",rel:"noopener noreferrer",children:"esbuild.outbase"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"src"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcemap",children:["sourceMap",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcemap",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Whether to generate sourceMap or not"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | 'inline' | 'external'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"sourcetype",children:["sourceType",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#sourcetype",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Sets the format of the source code. By default, the source code will be treated as EsModule. When the source code is using CommonJS, you need to set ",(0,i.jsx)(n.code,{children:"commonjs"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"'commonjs' | 'module'"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'module'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"splitting",children:["splitting",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#splitting",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Whether to enable code splitting.\nOnly support ",(0,i.jsx)(n.a,{href:"#format-esm",children:"format: 'esm'"})," and ",(0,i.jsx)(n.a,{href:"#format-cjs",children:"format: 'cjs'"}),",see ",(0,i.jsx)(n.a,{href:"https://esbuild.github.io/api/#splitting",target:"_blank",rel:"noopener noreferrer",children:"esbuild.splitting"})," learn more."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"style",children:["style",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#style",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure style-related configuration"}),"\n",(0,i.jsxs)(n.h2,{id:"styleless",children:["style.less",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleless",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"less-related configuration"}),"\n",(0,i.jsxs)(n.h2,{id:"stylelesslessoptions",children:["style.less.lessOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelesslessoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Refer to ",(0,i.jsx)(n.a,{href:"https://less.bootcss.com/usage/#less-options",target:"_blank",rel:"noopener noreferrer",children:"less"})," for detailed configuration"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{ javascriptEnabled: true }"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessadditionaldata",children:["style.less.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Add ",(0,i.jsx)(n.code,{children:"Less"})," code to the beginning of the entry file."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n additionalData: `@base-color: #c6538c;`,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylelessimplementation",children:["style.less.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylelessimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Configure the implementation library used by ",(0,i.jsx)(n.code,{children:"Less"}),", if not specified, the built-in version used is ",(0,i.jsx)(n.code,{children:"4.1.3"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the implementation library for ",(0,i.jsx)(n.code,{children:"Less"})," when the ",(0,i.jsx)(n.code,{children:"object"})," type is specified."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n implementation: require('less'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the ",(0,i.jsx)(n.code,{children:"string"})," type, specify the path to the implementation library for ",(0,i.jsx)(n.code,{children:"Less"})]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n less: {\n implementation: require.resolve('less'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesass",children:["style.sass",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesass",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"sass-related configuration."}),"\n",(0,i.jsxs)(n.h2,{id:"stylesasssassoptions",children:["style.sass.sassOptions",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesasssassoptions",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Refer to ",(0,i.jsx)(n.a,{href:"https://github.com/sass/node-sass#options",target:"_blank",rel:"noopener noreferrer",children:"node-sass"})," for detailed configuration."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassadditionaldata",children:["style.sass.additionalData",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassadditionaldata",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Add ",(0,i.jsx)(n.code,{children:"Sass"})," code to the beginning of the entry file."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n additionalData: `$base-color: #c6538c;\n $border-dark: rgba($base-color, 0.88);`,\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylesassimplementation",children:["style.sass.implementation",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylesassimplementation",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Configure the implementation library used by ",(0,i.jsx)(n.code,{children:"Sass"}),", the built-in version used is ",(0,i.jsx)(n.code,{children:"1.5.4"})," if not specified."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"undefined"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Specify the implementation library for ",(0,i.jsx)(n.code,{children:"Sass"})," when the ",(0,i.jsx)(n.code,{children:"object"})," type is specified."]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n implementation: require('sass'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For the ",(0,i.jsx)(n.code,{children:"string"})," type, specify the path to the ",(0,i.jsx)(n.code,{children:"Sass"})," implementation library"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n sass: {\n implementation: require.resolve('sass'),\n },\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"stylepostcss",children:["style.postcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylepostcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to configure options for PostCSS. The provided values will be merged with the default configuration using ",(0,i.jsx)(n.code,{children:"Object.assign"}),". Note that ",(0,i.jsx)(n.code,{children:"Object.assign"})," performs a shallow copy, so it will completely override the built-in ",(0,i.jsx)(n.code,{children:"plugins"})," array."]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed configuration, please refer to ",(0,i.jsx)(n.a,{href:"https://github.com/postcss/postcss#options",target:"_blank",rel:"noopener noreferrer",children:"PostCSS"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type PostcssOptions = {\n processOptions?: ProcessOptions;\n plugins?: AcceptedPlugin[];\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"const defaultConfig = {\n plugins: [\n // The following plugins are enabled by default\n require('postcss-flexbugs-fixes'),\n require('postcss-media-minmax'),\n require('postcss-nesting'),\n // The following plugins are only enabled when the target is `es5`\n require('postcss-custom-properties'),\n require('postcss-initial'),\n require('postcss-page-break'),\n require('postcss-font-variant'),\n ],\n};\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Example"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n postcss: {\n plugins: [yourPostCSSPlugin],\n },\n },\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"styleinject",children:["style.inject",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleinject",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Configure whether to insert CSS styles into JavaScript code in bundle mode."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Set ",(0,i.jsx)(n.code,{children:"inject"})," to ",(0,i.jsx)(n.code,{children:"true"})," to enable this feature:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n style: {\n inject: true,\n },\n },\n});\n"})}),"\n",(0,i.jsx)(n.p,{children:"Once enabled, you will see the CSS code referenced in the source code included in the bundled JavaScript output."}),"\n",(0,i.jsxs)(n.p,{children:["For example, if you write ",(0,i.jsx)(n.code,{children:"import './index.scss'"})," in the source code, you will see the following code in the output:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="dist/index.js"',children:"// node_modules/style-inject/dist/style-inject.es.js\nfunction styleInject(css, ref) {\n // ...\n}\nvar style_inject_es_default = styleInject;\n\n// src/index.scss\nvar css_248z = '.body {\\n color: black;\\n}';\nstyle_inject_es_default(css_248z);\n"})}),"\n",(0,i.jsxs)(n.div,{className:"rspress-directive tip",children:[(0,i.jsx)(n.div,{className:"rspress-directive-title",children:"TIP"}),(0,i.jsxs)(n.div,{className:"rspress-directive-content",children:["\n",(0,i.jsxs)(n.p,{children:["After enabling ",(0,i.jsx)(n.code,{children:"inject"}),", you need to pay attention to the following points:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"@import"})," in CSS files will not be processed. If your CSS file contains ",(0,i.jsx)(n.code,{children:"@import"}),", you need to manually import the CSS file in the JS file (less and scss files are not required because they have preprocessing)."]}),"\n",(0,i.jsxs)(n.li,{children:["Consider the impact of ",(0,i.jsx)(n.code,{children:"sideEffects"}),". By default, our builder assumes that CSS has side effects. If the ",(0,i.jsx)(n.code,{children:"sideEffects"})," field is set in your project or third-party package's package.json and does not include this CSS file, you will receive a warning:"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:'[LIBUILD:ESBUILD_WARN] Ignoring this import because "src/index.scss" was marked as having no side effects by plugin "libuild:adapter"\n'})}),"\n",(0,i.jsxs)(n.p,{children:["You can resolve this by configuring ",(0,i.jsx)(n.a,{href:"#sideeffects",children:"sideEffects"}),"."]}),"\n"]})]}),"\n",(0,i.jsxs)(n.h2,{id:"styleautomodules",children:["style.autoModules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styleautomodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Enable CSS Modules automatically based on the filename."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean | RegExp"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"true"})," : Enables CSS Modules for style files ending with ",(0,i.jsx)(n.code,{children:".module.css"})," ",(0,i.jsx)(n.code,{children:".module.less"})," ",(0,i.jsx)(n.code,{children:".module.scss"})," ",(0,i.jsx)(n.code,{children:".module.sass"})," filenames"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"false"})," : Disable CSS Modules."]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"RegExp"})," : Enables CSS Modules for all files that match the regular condition."]}),"\n",(0,i.jsxs)(n.h2,{id:"stylemodules",children:["style.modules",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#stylemodules",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"CSS Modules configuration"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["A common configuration is ",(0,i.jsx)(n.code,{children:"localsConvention"}),", which changes the class name generation rules for css modules"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n style: {\n modules: {\n localsConvention: 'camelCaseOnly',\n },\n },\n },\n};\n"})}),"\n",(0,i.jsx)(n.p,{children:"For the following styles"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-css",children:".box-title {\n color: red;\n}\n"})}),"\n",(0,i.jsxs)(n.p,{children:["You can use ",(0,i.jsx)(n.code,{children:"styles.boxTitle"})," to access"]}),"\n",(0,i.jsxs)(n.p,{children:["For detailed configuration see ",(0,i.jsx)(n.a,{href:"https://github.com/madyankin/postcss-modules#usage",target:"_blank",rel:"noopener noreferrer",children:"postcss-modules"})]}),"\n",(0,i.jsxs)(n.h2,{id:"styletailwindcss",children:["style.tailwindcss",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#styletailwindcss",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Used to modify the configuration of ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Tailwind CSS"}),"."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"const tailwind = {\n content: ['./src/**/*.{js,jsx,ts,tsx}', './config/html/**/*.{html,ejs,hbs}'],\n};\n"})}),"\n",(0,i.jsxs)(n.h3,{id:"enabling-tailwind-css",children:["Enabling Tailwind CSS",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#enabling-tailwind-css",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Before using ",(0,i.jsx)(n.code,{children:"style.tailwindcss"}),", you need to enable the Tailwind CSS plugin for Modern.js Module."]}),"\n",(0,i.jsxs)(n.p,{children:["Please refer to the section ",(0,i.jsx)(n.a,{href:"/guide/best-practices/use-tailwindcss.html",children:"Using Tailwind CSS"})," for instructions on how to enable it."]}),"\n",(0,i.jsxs)(n.h3,{id:"type",children:["Type",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#type",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["When the value is of type ",(0,i.jsx)(n.code,{children:"object"}),", it is merged with the default configuration via ",(0,i.jsx)(n.code,{children:"Object.assign"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["When the value is of type ",(0,i.jsx)(n.code,{children:"Function"}),", the object returned by the function is merged with the default configuration via ",(0,i.jsx)(n.code,{children:"Object.assign"}),"."]}),"\n",(0,i.jsxs)(n.p,{children:["The rest of the usage is the same as Tailwind CSS: ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"Quick Portal"}),"."]}),"\n",(0,i.jsxs)(n.h3,{id:"notes",children:["Notes",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#notes",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Please note that:"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["If you are using both the ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"})," file and ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," option, the configuration defined in ",(0,i.jsx)(n.code,{children:"tools.tailwindcss"})," will take precedence and override the content defined in ",(0,i.jsx)(n.code,{children:"tailwind.config.{ts,js}"}),"."]}),"\n",(0,i.jsxs)(n.li,{children:["If you are using the ",(0,i.jsx)(n.code,{children:"designSystem"})," configuration option simultaneously, the ",(0,i.jsx)(n.code,{children:"theme"})," configuration of Tailwind CSS will be overridden by the value of ",(0,i.jsx)(n.code,{children:"designSystem"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The usage of other configurations follows the same approach as the official usage of Tailwind CSS. Please refer to ",(0,i.jsx)(n.a,{href:"https://tailwindcss.com/docs/configuration",target:"_blank",rel:"noopener noreferrer",children:"tailwindcss - Configuration"})," for more details."]}),"\n",(0,i.jsxs)(n.h2,{id:"target",children:["target",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#target",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"target"})," is used to set the target environment for the generated JavaScript code. It enables Modern.js Module to transform JavaScript syntax that is not recognized by the target environment into older versions of JavaScript syntax that are compatible with these environments."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),":"]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",children:"type Target =\n | 'es5'\n | 'es6'\n | 'es2015'\n | 'es2016'\n | 'es2017'\n | 'es2018'\n | 'es2019'\n | 'es2020'\n | 'es2021'\n | 'es2022'\n | 'esnext';\n"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"'es6'"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["For example, compile the code to ",(0,i.jsx)(n.code,{children:"es5"})," syntax:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n target: 'es5',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"transformimport",children:["transformImport",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformimport",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Using ",(0,i.jsx)(n.a,{href:"https://swc.rs/",target:"_blank",rel:"noopener noreferrer",children:"SWC"})," provides the same ability and configuration as ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import",target:"_blank",rel:"noopener noreferrer",children:(0,i.jsx)(n.code,{children:"babel-plugin-import"})}),".\nWith this configuration, the code will be converted using SWC."]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"object[]"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"[]"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The elements of the array are configuration objects for ",(0,i.jsx)(n.code,{children:"babel-plugin-import"}),", which can be referred to ",(0,i.jsx)(n.a,{href:"https://github.com/umijs/babel-plugin-import#options",target:"_blank",rel:"noopener noreferrer",children:"options"}),"\u3002"]}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.strong,{children:"Example:"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n transformImport: [\n // babel-plugin-import`s options config\n {\n libraryName: 'foo',\n style: true,\n },\n ],\n },\n});\n"})}),"\n",(0,i.jsxs)(n.p,{children:["Reference the ",(0,i.jsx)(n.a,{href:"/plugins/official-list/plugin-import.html#notes",children:"Import Plugin - Notes"})]}),"\n",(0,i.jsxs)(n.h2,{id:"transformlodash",children:["transformLodash",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#transformlodash",children:"#"})]}),"\n",(0,i.jsxs)(n.p,{children:["Specifies whether to modularize the import of ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/lodash",target:"_blank",rel:"noopener noreferrer",children:"lodash"})," and remove unused lodash modules to reduce the code size of lodash."]}),"\n",(0,i.jsxs)(n.p,{children:["This optimization is implemented using ",(0,i.jsx)(n.a,{href:"https://www.npmjs.com/package/babel-plugin-lodash",target:"_blank",rel:"noopener noreferrer",children:"babel-plugin-lodash"})," and ",(0,i.jsx)(n.a,{href:"https://github.com/web-infra-dev/swc-plugins/tree/main/crates/plugin_lodash",target:"_blank",rel:"noopener noreferrer",children:"swc-plugin-lodash"})," under the hood."]}),"\n",(0,i.jsx)(n.p,{children:"With this configuration, the code will be converted using SWC."}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"boolean"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["When you enable this, Modern.js Module will automatically redirects the code references of ",(0,i.jsx)(n.code,{children:"lodash"})," to sub-paths."]}),"\n",(0,i.jsx)(n.p,{children:"For example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="input.js"',children:"import _ from 'lodash';\nimport { add } from 'lodash/fp';\n\nconst addOne = add(1);\n_.map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsx)(n.p,{children:"The transformed code will be:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-ts",meta:'title="output.js"',children:"import _add from 'lodash/fp/add';\nimport _map from 'lodash/map';\n\nconst addOne = _add(1);\n_map([1, 2, 3], addOne);\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"tsconfig",children:["tsconfig",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#tsconfig",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Path to the tsconfig file"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"tsconfig.json"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Version"}),": ",(0,i.jsx)(n.code,{children:">=2.36.0"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default defineConfig({\n buildConfig: {\n tsconfig: 'tsconfig.build.json',\n },\n});\n"})}),"\n",(0,i.jsxs)(n.h2,{id:"umdglobals",children:["umdGlobals",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdglobals",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specify global variables for external import of umd artifacts"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"Record"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n umdGlobals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point, ",(0,i.jsx)(n.code,{children:"react"})," and ",(0,i.jsx)(n.code,{children:"react-dom"})," will be seen as global variables imported externally and will not be packed into the umd product, but will be accessible by way of ",(0,i.jsx)(n.code,{children:"global.React"})," and ",(0,i.jsx)(n.code,{children:"global.ReactDOM"})]}),"\n",(0,i.jsxs)(n.h2,{id:"umdmodulename",children:["umdModuleName",(0,i.jsx)(n.a,{className:"header-anchor","aria-hidden":"true",href:"#umdmodulename",children:"#"})]}),"\n",(0,i.jsx)(n.p,{children:"Specifies the module name of the umd product"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Type"}),": ",(0,i.jsx)(n.code,{children:"string | Function"})]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.strong,{children:"Default"}),": ",(0,i.jsx)(n.code,{children:"name => name"})]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",children:"export default {\n buildConfig: {\n format: 'umd',\n umdModuleName: 'myLib',\n },\n};\n"})}),"\n",(0,i.jsxs)(n.p,{children:["At this point the umd artifact will go to mount on ",(0,i.jsx)(n.code,{children:"global.myLib"})]}),"\n",(0,i.jsx)(n.p,{children:":::tip"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"The module name of the umd artifact must not conflict with the global variable name."}),"\n",(0,i.jsxs)(n.li,{children:["Module names will be converted to camelCase, e.g. ",(0,i.jsx)(n.code,{children:"my-lib"})," will be converted to ",(0,i.jsx)(n.code,{children:"myLib"}),", refer to ",(0,i.jsx)(n.a,{href:"https://github.com/babel/babel/blob/main/packages/babel-types/src/converters/toIdentifier.ts",target:"_blank",rel:"noopener noreferrer",children:"toIdentifier"}),".\n:::"]}),"\n"]}),"\n",(0,i.jsx)(n.p,{children:"Also the function form can take one parameter, which is the output path of the current package file"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-js",meta:'title="modern.config.ts"',children:"export default {\n buildConfig: {\n format: 'umd',\n umdModuleName: path => {\n if (path.includes('index')) {\n return 'myLib';\n } else {\n return 'myLib2';\n }\n },\n },\n};\n"})})]})}function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,r.ah)(),e.components);return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(t,{...e})}):t(e)}let d=l;l.__RSPRESS_PAGE_META={},l.__RSPRESS_PAGE_META["en%2Fapi%2Fconfig%2Fbuild-config.mdx"]={toc:[{text:"alias",id:"alias",depth:2},{text:"asset",id:"asset",depth:2},{text:"asset.name",id:"assetname",depth:2},{text:"asset.limit",id:"assetlimit",depth:2},{text:"asset.path",id:"assetpath",depth:2},{text:"asset.publicPath",id:"assetpublicpath",depth:2},{text:"asset.svgr",id:"assetsvgr",depth:2},{text:"asset.svgr.include",id:"assetsvgrinclude",depth:2},{text:"asset.svgr.exclude",id:"assetsvgrexclude",depth:2},{text:"asset.svgr.exportType",id:"assetsvgrexporttype",depth:2},{text:"autoExtension",id:"autoextension",depth:2},{text:"autoExternal",id:"autoexternal",depth:2},{text:"autoExternal.dependencies",id:"autoexternaldependencies",depth:2},{text:"autoExternal.peerDependencies",id:"autoexternalpeerdependencies",depth:2},{text:"banner",id:"banner",depth:2},{text:"buildType",id:"buildtype",depth:2},{text:"copy",id:"copy",depth:2},{text:"copy.patterns",id:"copypatterns",depth:2},{text:"copy.options",id:"copyoptions",depth:2},{text:"define",id:"define",depth:2},{text:"dts",id:"dts",depth:2},{text:"dts.abortOnError",id:"dtsabortonerror",depth:2},{text:"dts.distPath",id:"dtsdistpath",depth:2},{text:"dts.enableTscBuild",id:"dtsenabletscbuild",depth:2},{text:"dts.only",id:"dtsonly",depth:2},{text:"dts.tsconfigPath",id:"dtstsconfigpath",depth:2},{text:"dts.respectExternal",id:"dtsrespectexternal",depth:2},{text:"esbuildOptions",id:"esbuildoptions",depth:2},{text:"externalHelpers",id:"externalhelpers",depth:2},{text:"externals",id:"externals",depth:2},{text:"footer",id:"footer",depth:2},{text:"format",id:"format",depth:2},{text:"format: esm",id:"format-esm",depth:3},{text:"format: cjs",id:"format-cjs",depth:3},{text:"format: iife",id:"format-iife",depth:3},{text:"format: umd",id:"format-umd",depth:3},{text:"hooks",id:"hooks",depth:2},{text:"input",id:"input",depth:2},{text:"jsx",id:"jsx",depth:2},{text:"metafile",id:"metafile",depth:2},{text:"minify",id:"minify",depth:2},{text:"outDir",id:"outdir",depth:2},{text:"platform",id:"platform",depth:2},{text:"redirect",id:"redirect",depth:2},{text:"resolve",id:"resolve",depth:2},{text:"resolve.alias",id:"resolvealias",depth:3},{text:"resolve.mainFields",id:"resolvemainfields",depth:3},{text:"resolve.jsExtentions",id:"resolvejsextentions",depth:3},{text:"shims",id:"shims",depth:2},{text:"sideEffects",id:"sideeffects",depth:2},{text:"sourceDir",id:"sourcedir",depth:2},{text:"sourceMap",id:"sourcemap",depth:2},{text:"sourceType",id:"sourcetype",depth:2},{text:"splitting",id:"splitting",depth:2},{text:"style",id:"style",depth:2},{text:"style.less",id:"styleless",depth:2},{text:"style.less.lessOptions",id:"stylelesslessoptions",depth:2},{text:"style.less.additionalData",id:"stylelessadditionaldata",depth:2},{text:"style.less.implementation",id:"stylelessimplementation",depth:2},{text:"style.sass",id:"stylesass",depth:2},{text:"style.sass.sassOptions",id:"stylesasssassoptions",depth:2},{text:"style.sass.additionalData",id:"stylesassadditionaldata",depth:2},{text:"style.sass.implementation",id:"stylesassimplementation",depth:2},{text:"style.postcss",id:"stylepostcss",depth:2},{text:"style.inject",id:"styleinject",depth:2},{text:"style.autoModules",id:"styleautomodules",depth:2},{text:"style.modules",id:"stylemodules",depth:2},{text:"style.tailwindcss",id:"styletailwindcss",depth:2},{text:"Enabling Tailwind CSS",id:"enabling-tailwind-css",depth:3},{text:"Type",id:"type",depth:3},{text:"Notes",id:"notes",depth:3},{text:"target",id:"target",depth:2},{text:"transformImport",id:"transformimport",depth:2},{text:"transformLodash",id:"transformlodash",depth:2},{text:"tsconfig",id:"tsconfig",depth:2},{text:"umdGlobals",id:"umdglobals",depth:2},{text:"umdModuleName",id:"umdmodulename",depth:2}],title:"buildConfig",frontmatter:{sidebar_position:1}}}}]); \ No newline at end of file diff --git a/modern-js/module-tools/static/js/index.fb752709.js b/modern-js/module-tools/static/js/index.8bcc18b3.js similarity index 98% rename from modern-js/module-tools/static/js/index.fb752709.js rename to modern-js/module-tools/static/js/index.8bcc18b3.js index 6f6cd616e7..91b74b5788 100644 --- a/modern-js/module-tools/static/js/index.fb752709.js +++ b/modern-js/module-tools/static/js/index.8bcc18b3.js @@ -1 +1 @@ -(()=>{"use strict";var e={2285:function(e,n,t){t.r(n),t.d(n,{Aside:function(){return r.xN},Badge:function(){return r.Ct},Button:function(){return r.zx},DocFooter:function(){return r.Qn},DocLayout:function(){return r.RY},EditLink:function(){return r.mi},HomeFeature:function(){return r.BZ},HomeFooter:function(){return r.xK},HomeHero:function(){return r.xB},HomeLayout:function(){return r.Os},LastUpdated:function(){return r.O9},Layout:function(){return r.Ar},Link:function(){return r.rU},Nav:function(){return r.JL},NotFoundLayout:function(){return r.qx},Overview:function(){return r.g2},PackageManagerTabs:function(){return r.SU},PrevNextPage:function(){return r.Qe},RenderType:function(){return r.y2},ScrollToTop:function(){return r.pU},Search:function(){return r.ol},SearchPanel:function(){return r.EG},Sidebar:function(){return r.YE},SocialLinks:function(){return r.WG},SourceCode:function(){return r.ZB},Steps:function(){return r.Rg},SwitchAppearance:function(){return r.KO},Tab:function(){return r.OK},Tabs:function(){return r.mQ},Tag:function(){return r.Vp},Toc:function(){return r.of},bindingAsideScroll:function(){return r.UQ},default:function(){return r.ZP},getCustomMDXComponent:function(){return r.TJ},isActive:function(){return r.zh},isMobileDevice:function(){return r.s2},parseInlineMarkdownText:function(){return r.H_},renderHtmlOrText:function(){return r.NG},renderInlineMarkdown:function(){return r.VA},scrollToTarget:function(){return r.eF},setup:function(){return r.cY},useEditLink:function(){return r.CU},useEnableNav:function(){return r.CF},useFullTextSearch:function(){return r.YS},useHiddenNav:function(){return r.Vl},useLocaleSiteData:function(){return r.M4},usePathUtils:function(){return r.eE},usePrevNextPage:function(){return r.WS},useRedirect4FirstVisit:function(){return r.AV},useSidebarData:function(){return r.tx},useThemeState:function(){return r.ls}});var r=t(4031)}},n={};function t(r){var u=n[r];if(void 0!==u)return u.exports;var o=n[r]={exports:{}};return e[r].call(o.exports,o,o.exports,t),o.exports}t.m=e,t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},(()=>{var e,n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};t.t=function(r,u){if(1&u&&(r=this(r)),8&u||"object"==typeof r&&r&&(4&u&&r.__esModule||16&u&&"function"==typeof r.then))return r;var o=Object.create(null);t.r(o);var c={};e=e||[null,n({}),n([]),n(n)];for(var f=2&u&&r;"object"==typeof f&&!~e.indexOf(f);f=n(f))Object.getOwnPropertyNames(f).forEach(function(e){c[e]=function(){return r[e]}});return c.default=function(){return r},t.d(o,c),o}})(),t.d=function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.f={},t.e=function(e){return Promise.all(Object.keys(t.f).reduce(function(n,r){return t.f[r](e,n),n},[]))},t.u=function(e){return"static/js/async/"+e+"."+({1:"863db834",1042:"ef56ec90",1086:"c8bae3b4",109:"afb89738",1178:"11200bd8",1286:"2a17c2f8",1415:"2f563664",150:"c311a0cf",1571:"e1e5c3ac",1645:"ced15c41",1655:"fa9781e8",1787:"388cb52d",1857:"27c61f58",1920:"c6721f0c",207:"c1f284fa",2122:"bfc5a33e",2125:"50f73444",2138:"a1fa3620",2539:"007f0ff7",2546:"ae789452",2598:"5d808abf",266:"68067a52",2828:"08b75ca6",2932:"d6fbddf2",3069:"3c19505a",3110:"a2d9794b",3238:"473f6587",3241:"08e9358b",3264:"389faa59",3390:"277720bb",3452:"f72498e8",3495:"2f646c4c",3515:"4f6148e4",3669:"20db632e",3771:"b81fd79b",3884:"ed173e46",3978:"20f31a6a",4038:"afeb0994",4457:"5862293c",4503:"69a268c2",4534:"af359768",455:"5dfb6b99",4595:"0ac818e2",4639:"ac2c02df",4781:"9d44715c",4800:"498aa78c",4813:"a7813f70",4831:"c033ce8b",5116:"3fc24b7c",5279:"2817e508",5302:"c77161b4",5353:"28030123",5570:"7a5eec18",5661:"e57e9080",5816:"610988dc",5864:"aa7a2878",598:"2dd6bcde",6111:"5815e392",6147:"854ce51e",6156:"d78f16a7",6186:"494355a2",6231:"92439eb5",6486:"24ea8415",6663:"bd639e76",6677:"027aec5d",6832:"0865051d",7047:"31cf2655",7129:"1b1d07a4",7207:"8149a41a",7244:"a0eab7da",7316:"87618c9c",7402:"6a67c6fc",7410:"6c97d078",768:"6c5f48e4",7790:"a114ef2c",7936:"30ac7cf3",8052:"cfa38f3d",8169:"302f7080",8477:"ae1fb3e5",8603:"c50b29c4",864:"e049447d",8648:"46813d66",8820:"f0efb3bd",9033:"5f21d33a",9251:"06ba8194",9382:"b28659dd",9481:"f5f132d1",9513:"c1c9585a",9710:"71e6fabd",9725:"b0a5d625",9892:"d6fd630d",9905:"e256a3a9"})[e]+".js"},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},(()=>{var e={},n="@modern-js/module-tools-docs:";t.l=function(r,u,o,c){if(e[r]){e[r].push(u);return}if(void 0!==o){for(var f,i,a=document.getElementsByTagName("script"),d=0;d{var e=[];t.O=function(n,r,u,o){if(r){o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[r,u,o];return}for(var f=1/0,c=0;c=o)&&Object.keys(t.O).every(function(e){return t.O[e](r[a])})?r.splice(a--,1):(i=!1,o{var e={2980:0};t.f.j=function(n,r){var u=t.o(e,n)?e[n]:void 0;if(0!==u){if(u)r.push(u[2]);else{var o=new Promise(function(t,r){u=e[n]=[t,r]});r.push(u[2]=o);var c=t.p+t.u(n),f=Error();t.l(c,function(r){if(t.o(e,n)&&(0!==(u=e[n])&&(e[n]=void 0),u)){var o=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+n+" failed.\n("+o+": "+c+")",f.name="ChunkLoadError",f.type=o,f.request=c,u[1](f)}},"chunk-"+n,n)}}},t.O.j=function(n){return 0===e[n]};var n=function(n,r){var u=r[0],o=r[1],c=r[2],f,i,a=0;if(u.some(function(n){return 0!==e[n]})){for(f in o)t.o(o,f)&&(t.m[f]=o[f]);if(c)var d=c(t)}for(n&&n(r);a{"use strict";var e={2285:function(e,n,t){t.r(n),t.d(n,{Aside:function(){return r.xN},Badge:function(){return r.Ct},Button:function(){return r.zx},DocFooter:function(){return r.Qn},DocLayout:function(){return r.RY},EditLink:function(){return r.mi},HomeFeature:function(){return r.BZ},HomeFooter:function(){return r.xK},HomeHero:function(){return r.xB},HomeLayout:function(){return r.Os},LastUpdated:function(){return r.O9},Layout:function(){return r.Ar},Link:function(){return r.rU},Nav:function(){return r.JL},NotFoundLayout:function(){return r.qx},Overview:function(){return r.g2},PackageManagerTabs:function(){return r.SU},PrevNextPage:function(){return r.Qe},RenderType:function(){return r.y2},ScrollToTop:function(){return r.pU},Search:function(){return r.ol},SearchPanel:function(){return r.EG},Sidebar:function(){return r.YE},SocialLinks:function(){return r.WG},SourceCode:function(){return r.ZB},Steps:function(){return r.Rg},SwitchAppearance:function(){return r.KO},Tab:function(){return r.OK},Tabs:function(){return r.mQ},Tag:function(){return r.Vp},Toc:function(){return r.of},bindingAsideScroll:function(){return r.UQ},default:function(){return r.ZP},getCustomMDXComponent:function(){return r.TJ},isActive:function(){return r.zh},isMobileDevice:function(){return r.s2},parseInlineMarkdownText:function(){return r.H_},renderHtmlOrText:function(){return r.NG},renderInlineMarkdown:function(){return r.VA},scrollToTarget:function(){return r.eF},setup:function(){return r.cY},useEditLink:function(){return r.CU},useEnableNav:function(){return r.CF},useFullTextSearch:function(){return r.YS},useHiddenNav:function(){return r.Vl},useLocaleSiteData:function(){return r.M4},usePathUtils:function(){return r.eE},usePrevNextPage:function(){return r.WS},useRedirect4FirstVisit:function(){return r.AV},useSidebarData:function(){return r.tx},useThemeState:function(){return r.ls}});var r=t(4031)}},n={};function t(r){var u=n[r];if(void 0!==u)return u.exports;var o=n[r]={exports:{}};return e[r].call(o.exports,o,o.exports,t),o.exports}t.m=e,t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},(()=>{var e,n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};t.t=function(r,u){if(1&u&&(r=this(r)),8&u||"object"==typeof r&&r&&(4&u&&r.__esModule||16&u&&"function"==typeof r.then))return r;var o=Object.create(null);t.r(o);var c={};e=e||[null,n({}),n([]),n(n)];for(var f=2&u&&r;"object"==typeof f&&!~e.indexOf(f);f=n(f))Object.getOwnPropertyNames(f).forEach(function(e){c[e]=function(){return r[e]}});return c.default=function(){return r},t.d(o,c),o}})(),t.d=function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},t.f={},t.e=function(e){return Promise.all(Object.keys(t.f).reduce(function(n,r){return t.f[r](e,n),n},[]))},t.u=function(e){return"static/js/async/"+e+"."+({1:"863db834",1042:"ef56ec90",1086:"c8bae3b4",109:"afb89738",1178:"11200bd8",1286:"2a17c2f8",1415:"2f563664",150:"c311a0cf",1571:"e1e5c3ac",1645:"ced15c41",1655:"fa9781e8",1787:"388cb52d",1857:"27c61f58",1920:"c6721f0c",207:"c1f284fa",2122:"bfc5a33e",2125:"50f73444",2138:"a1fa3620",2539:"007f0ff7",2546:"ae789452",2598:"5d808abf",266:"68067a52",2828:"08b75ca6",2932:"d6fbddf2",3069:"3c19505a",3110:"a2d9794b",3238:"473f6587",3241:"08e9358b",3264:"389faa59",3390:"277720bb",3452:"f72498e8",3495:"2f646c4c",3515:"4f6148e4",3669:"20db632e",3771:"b81fd79b",3884:"ed173e46",3978:"20f31a6a",4038:"afeb0994",4457:"5862293c",4503:"69a268c2",4534:"af359768",455:"5dfb6b99",4595:"0ac818e2",4639:"a2a77f95",4781:"9d44715c",4800:"498aa78c",4813:"a7813f70",4831:"c033ce8b",5116:"3fc24b7c",5279:"2817e508",5302:"c77161b4",5353:"28030123",5570:"7a5eec18",5661:"e57e9080",5816:"610988dc",5864:"cf8b0f83",598:"2dd6bcde",6111:"5815e392",6147:"854ce51e",6156:"d78f16a7",6186:"494355a2",6231:"92439eb5",6486:"24ea8415",6663:"bd639e76",6677:"027aec5d",6832:"0865051d",7047:"31cf2655",7129:"1b1d07a4",7207:"8149a41a",7244:"a0eab7da",7316:"87618c9c",7402:"6a67c6fc",7410:"6c97d078",768:"6c5f48e4",7790:"a114ef2c",7936:"30ac7cf3",8052:"cfa38f3d",8169:"302f7080",8477:"ae1fb3e5",8603:"c50b29c4",864:"e049447d",8648:"46813d66",8820:"f0efb3bd",9033:"5f21d33a",9251:"06ba8194",9382:"b28659dd",9481:"f5f132d1",9513:"c1c9585a",9710:"71e6fabd",9725:"b0a5d625",9892:"d6fd630d",9905:"e256a3a9"})[e]+".js"},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},(()=>{var e={},n="@modern-js/module-tools-docs:";t.l=function(r,u,o,c){if(e[r]){e[r].push(u);return}if(void 0!==o){for(var f,i,a=document.getElementsByTagName("script"),d=0;d{var e=[];t.O=function(n,r,u,o){if(r){o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[r,u,o];return}for(var f=1/0,c=0;c=o)&&Object.keys(t.O).every(function(e){return t.O[e](r[a])})?r.splice(a--,1):(i=!1,o{var e={2980:0};t.f.j=function(n,r){var u=t.o(e,n)?e[n]:void 0;if(0!==u){if(u)r.push(u[2]);else{var o=new Promise(function(t,r){u=e[n]=[t,r]});r.push(u[2]=o);var c=t.p+t.u(n),f=Error();t.l(c,function(r){if(t.o(e,n)&&(0!==(u=e[n])&&(e[n]=void 0),u)){var o=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+n+" failed.\n("+o+": "+c+")",f.name="ChunkLoadError",f.type=o,f.request=c,u[1](f)}},"chunk-"+n,n)}}},t.O.j=function(n){return 0===e[n]};var n=function(n,r){var u=r[0],o=r[1],c=r[2],f,i,a=0;if(u.some(function(n){return 0!==e[n]})){for(f in o)t.o(o,f)&&(t.m[f]=o[f]);if(c)var d=c(t)}for(n&&n(r);a name)\n * Default: [name].[hash].[ext]\n\nWhen asset.name is a string, it will automatically replace [name], [ext], and\n[hash], respectively replaced by the file name, extension, and file hash.\n\nAlso you can use asset.name as a function, and the return is output asset name.\nAt this time, this function receives a parameter assetPath, which corresponds to\nthe resource path.\n\n\n\n\nasset.limit#\n\nUsed to set the threshold for static assets to be automatically inlined as\nbase64.\n\nBy default, Modern.js Module will inline assets such as images, fonts and media\nsmaller than 10KB during bundling. They are Base64 encoded and inlined in the\nbundles, eliminating the need for separate HTTP requests.\n\nYou can adjust this threshold by modifying the limit config.\n\n * Type: number\n * Default: 10 * 1024\n\nFor example, set limit to 0 to avoid assets inlining:\n\n\n\n\nasset.path#\n\nStatic resource output path, will be based on outDir\n\n * Type: string\n * Default: assets\n\n\nasset.publicPath#\n\nThe CDN prefix given to unlinked assets when bundling.\n\n * Type: string\n * Default: undefined\n\n\n\nAt this point, all static assets will be prefixed with https://xxx/.\n\n\nasset.svgr#\n\nPackaged to handle svg as a React component, options reference svgr, plus\nsupport for two configuration options include and exclude to match the svg file\nto be handled\n\n * Type: boolean | object\n * Default: false\n\nWhen svgr feature is enabled, you can use svg as a component using the default\nexport.\n\n\n\nWhen enabled, the type of svg used can be modified by initing a new declaration\nfile and adding to the modern-app-env.d.ts:\n\n\n\n\n\n\nasset.svgr.include#\n\nSet the matching svg file\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: /\\.svg$/\n\n\nasset.svgr.exclude#\n\nSet unmatched svg files\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: undefined\n\n\nasset.svgr.exportType#\n\nUsed to configure the SVG export type when using SVGR.\n\n * Type: 'named' | 'default'\n * Default: default\n\nwhen it is 'named', use the following syntax:\n\n\n\nThe named export defaults to ReactComponent, and can be customized with the\nasset.svgr.namedExport.\n\n\nautoExtension#\n\nSuffixes for js files and type description files in automation based on format\nand type.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\nWhen disabled, js artifacts are suffixed with .js and type description files are\nsuffixed with d.ts.\n\nWhen enabled, node loads .js as esm by default when type is module, so when we\nwant to output cjs artifacts, the js product is suffixed with .cjs and the type\ndescription file is suffixed with d.cts.\n\nOn the other hand, if the type field is missing or the type is commonjs, node\nloads the .js file as cjs by default. So when we want to output esm output, the\njs output is suffixed with .mjs and the type description file is suffixed with\nd.mts.\n\n:::warning When used in bundleless mode, we have an extra step of processing the\nimport/export statement in each file. We will suffix the relative path to the js\nfile, possibly .mjs or .cjs, depending on your package configuration. You can\ndisable this step by redirect.autoExtension.\n\nNotice noUselessIndex will break this behavior, you should disable it. If you\nneed to use this configuration in bundleless, please patch the index, e.g. if\nutils is a folder, you need to rewrite to\n\n\n\n\nautoExternal#\n\nAutomatically externalize project dependencies and peerDependencies and not\npackage them into the final bundle\n\n * Type: boolean | object\n * Default: true\n\nWhen we want to turn off the default handling behavior for third-party\ndependencies, we can do so by:\n\n\n\nThis way the dependencies under \"dependencies\" and \"peerDependencies\" will be\nbundled. If you want to turn off the processing of only one of these\ndependencies, you can use the buildConfig.autoExternal in the form of an object.\n\n\n\n\nautoExternal.dependencies#\n\nWhether or not the dep dependencies of the external project are needed\n\n * Type: boolean\n * Default: true\n\n\nautoExternal.peerDependencies#\n\nWhether to require peerDep dependencies for external projects\n\n * Type: boolean\n * Default: true\n\n\nbanner#\n\nProvides the ability to inject content into the top and bottom of each JS , CSS\nand DTS file.\n\n\n\n * Type: BannerAndFooter\n * Default: {}\n * Version: >=2.36.0\n\nLet's say you want to add copyright information to JS and CSS files.\n\n\n\n\nbuildType#\n\nThe build type, bundle will package your code, bundleless will only do the code\nconversion\n\n * Type: 'bundle' | 'bundleless'\n * Default: 'bundle'\n\n\ncopy#\n\nCopies the specified file or directory into the build output directory\n\n * Type: object[]\n * Default: []\n\n\n\nReference for array settings: copy-webpack-plugin patterns\n\n\ncopy.patterns#\n\n * Type: CopyPattern[]\n * Default: []\n\n\n\n\ncopy.options#\n\n * Type:\n\n\n\n * Default: { concurrency: 100, enableCopySync: false }\n\n * concurrency: Specifies how many copy tasks to execute in parallel.\n\n * enableCopySync: Uses fs.copySync by default, instead of fs.copy.\n\n\ndefine#\n\nDefine global variables that will be injected into the code\n\n * Type: Record\n * Default: {}\n\nSince the define function is implemented by global text replacement, you need to\nensure that the global variable values are strings. A safer approach is to\nconvert the value of each global variable to a string, as follows.\n\nINFO\n\nModern.js automatically performs JSON serialization handling internally, so\nmanual serialization is not required.\n\nIf automatic serialization is not needed, you can define alias using\nesbuildOptions configuration.\n\n\n\nIf the project is a TypeScript project, then you may need to add the following\nto the .d.ts file in the project source directory.\n\n> If the .d.ts file does not exist, then you can create it manually.\n\n\n\nYou can also replace environment variable:\n\n\n\nWith the above configuration, we can put the following code.\n\n\n\nWhen executing VERSION=1.0.0 modern build, the conversion is:\n\n\n\nTIP\n\nTo prevent excessive global replacement substitution, it is recommended that the\nfollowing two principles be followed when using\n\n * Use upper case for global constants\n * Customize the prefix and suffix of global constants to ensure uniqueness\n\n\ndts#\n\nThe dts file generates the relevant configuration, by default it generates.\n\n * Type: false | object\n * Default:\n\n\n\n\ndts.abortOnError#\n\nWhether to allow the build to succeed if a type error occurs.\n\n * Type: boolean\n * Default: true\n\nBy default, type errors will cause the build to fail. When abortOnError is set\nto false, the build will still succeed even if there are type issues in the\ncode:\n\n\n\nWARNING\n\nWhen this configuration is disabled, there is no guarantee that the type files\nwill be generated correctly. In buildType: 'bundle', which is the bundle mode,\ntype files will not be generated.\n\n\ndts.distPath#\n\nThe output path of the dts file, based on outDir\n\n * Type: string\n * Default: ./\n\nFor example, output to the types directory under the outDir:\n\n\n\n\ndts.enableTscBuild#\n\nEnable the tsc '--build' option. When using project reference, you can use the\n'--build' option to achieve cooperation between projects and speed up the build\nspeed.\n\nThis option requires version > 2.43.0,In fact, we experimentally enabled this\noption in the 2.42.0 version, but the many problems it brought forced us to\nenable it dynamically.\n\n\n\n * Type: boolean\n * Default: false\n * Version: >2.43.0\n\n\n\n\ndts.only#\n\nWhether to generate only type files during the build process without generating\nJavaScript output files.\n\n * Type: boolean\n * Default: false\n\n\n\n\ndts.tsconfigPath#\n\ndeprecated,use tsconfig instead.\n\nSpecifies the path to the tsconfig file used to generate the type file.\n\n\n\n\ndts.respectExternal#\n\nWhen set to false, the type of third-party packages will be excluded from the\nbundle, when set to true, it will determine whether third-party types need to be\nbundled based on externals.\n\nWhen bundle d.ts, export is not analyzed, so any third-party package type you\nuse may break your build, which is obviously uncontrollable. So we can avoid it\nwith this configuration.\n\n * Type: boolean\n * Default: true\n\n\n\n\nesbuildOptions#\n\nUsed to modify the esbuild configuration.\n\n * Type: Function\n * Build Type: Only supported for buildType: 'bundle'\n * Default: c => c\n\nFor example, if we need to modify the file extension of the generated files:\n\n\n\nFor example, register an esbuild plugin:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\nTIP\n\nWe have done many extensions based on the original esbuild build. Therefore,\nwhen using this configuration, pay attention to the following:\n\n 1. Prefer to use the configuration that Modern.js Module provides. For example,\n esbuild does not support target: 'es5', but we support this scenario\n internally using SWC. Setting target: 'es5' through esbuildOptions will\n result in an error.\n 2. Currently, we use enhanced-resolve internally to replace esbuild's resolve\n algorithm, so modifying esbuild resolve-related configurations is invalid.\n We plan to switch back in the future.\n\n\nexternalHelpers#\n\nBy default, the output JS code may depend on helper functions to support the\ntarget environment or output format, and these helper functions will be inlined\nin the file that requires it.\n\nWith this configuration, the code will be converted using SWC, it will inline\nhelper functions to import them from the external module @swc/helpers.\n\n * Type: boolean\n * Default: false\n\nBelow is a comparison of the output file changes before and after using this\nconfiguration.\n\nBefore enable:\n\n\n\nAfter enabled:\n\n\n\n\nexternals#\n\nConfigure external dependencies that will not be bundled into the final bundle.\n\n * Type:\n\n\n\n * Default: []\n * Build Type: Only supported for buildType: 'bundle'\n * Example:\n\n\n\n\nfooter#\n\nSame as the banner configuration for adding a comment at the end of the output\nfile.\n\n\nformat#\n\nUsed to set the output format of JavaScript files. The options iife and umd only\ntake effect when buildType is bundle.\n\n * Type: 'esm' | 'cjs' | 'iife' | 'umd'\n * Default: cjs\n\n\nformat: esm#\n\nesm stands for \"ECMAScript module\" and requires the runtime environment to\nsupport import and export syntax.\n\n * Example:\n\n\n\n\nformat: cjs#\n\ncjs stands for \"CommonJS\" and requires the runtime environment to support\nexports, require, and module syntax. This format is commonly used in Node.js\nenvironments.\n\n * Example:\n\n\n\n\nformat: iife#\n\niife stands for \"immediately-invoked function expression\" and wraps the code in\na function expression to ensure that any variables in the code do not\naccidentally conflict with variables in the global scope. This format is\ncommonly used in browser environments.\n\n * Example:\n\n\n\n\nformat: umd#\n\numd stands for \"Universal Module Definition\" and is used to run modules in\ndifferent environments such as browsers and Node.js. Modules in UMD format can\nbe used in various environments, either as global variables or loaded as modules\nusing module loaders like RequireJS.\n\n * Example:\n\n\n\n\nhooks#\n\nBuild lifecycle hooks that allow custom logic to be injected at specific stages\nof the build process.\n\n * Types:\n\n\n\n * Default: [].\n\nWe can get the compiler instance in the apply method, modify its properties, and\nexecute custom logic at different stages. For more information on Hooks, see\n[Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in\nthe Build Process]). For more information on Hooks, see\nUsing-hooks-to-intervene-in-the-build-process.\n\n\n\n\ninput#\n\nSpecify the entry file for the build, in the form of an array that can specify\nthe directory\n\n * Type:\n\n\n\n * Default: ['src/index.ts'] in bundle mode, ['src'] in bundleless mode\n\nArray usage:\n\nIn bundle mode, the following configurations will be built using src/index.ts\nand src/index2.ts as entry points. The bundle mode does not support configuring\ninput as a directory.\n\n\n\nIn bundleless mode, the following configuration compiles both files in the src/a\ndirectory and src/index.ts file.\n\n\n\nIn bundleless mode, Array usage also supports the usage of ! to filter partial\nfiles:\n\n\n\nThe above configuration will build the files in the src directory, and will also\nfilter files with the spec.ts suffix.This is useful in cases where the test\nfiles are in the same root directory as the source files.\n\nObject usage:\n\nWhen you need to modify the output file name in bundle mode, you can use an\nobject configuration.\n\nThe key of the object is the file name of the output, and the value is the file\npath of the source code.\n\n\n\n\njsx#\n\nSpecify the compilation method for JSX, which by default supports React 17 and\nhigher versions and automatically injects JSX runtime code.\n\n * Type: automatic | transform\n * Default: automatic\n\nIf you need to support React 16, you can set jsx to transform:\n\n\n\nTIP\n\nIf you don't need to convert JSX, you can set jsx to preserve, but don't use swc\nto do the code conversion. For more information about JSX Transform, you can\nrefer to the following links:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\nThis option is used for build analysis. When enabled, esbuild will generate\nmetadata about the build in JSON format.\n\n * Type: boolean\n * Default: false\n * Build Type: Only supported for buildType: 'bundle'\n\nTo enable metafile generation:\n\n\n\nAfter executing the build, a metafile-[xxx].json file will be generated in the\noutput directory. You can use tools like esbuild analyze and bundle-buddy for\nvisual analysis.\n\n\nminify#\n\nUse esbuild or terser to compress code, also pass terserOptions\n\n * Type: 'terser' | 'esbuild' | false | object\n * Default: false\n\n\n\n\noutDir#\n\nSpecifies the output directory of the build.\n\n * Type: string\n * Default: ./dist\n\n\n\n\nplatform#\n\nGenerates code for the node environment by default, you can also specify browser\nwhich will generate code for the browser environment. See esbuild.platform learn\nmore.\n\n * Type: 'browser' | 'node'\n * Default: 'node'\n\n\n\n\nredirect#\n\nIn buildType: 'bundleless' build mode, the reference path is redirected to\nensure that it points to the correct product, e.g:\n\n * import '. /index.less' will be rewritten to import '. /index.css'\n * would be rewritten as to `` (depending on the situation)\n * will be rewritten to (if generate utils.mjs, depending on the situation)\n\nIn some scenarios, you may not need these functions, then you can turn it off\nwith this configuration, and its reference path will not be changed after\nturning it off.\n\n\n\n\nresolve#\n\nCustom module resolution options\n\n\nresolve.alias#\n\nThe basic usage is the same as alias.\n\nThe issue with alias is that we incorrectly handled Module IDs in a bundleless\nscenario:\n\n\n\nWhen we configure alias: { react: 'react-native' }, the result becomes:\n\n\n\nA Module ID is incorrectly processed as a relative path, which is not expected.\n\nWe want to fix this issue, but it may break existing projects.\n\nTherefore, in 2.58.0, we provided resolve.alias to solve this problem.\nAdditionally, resolve.alias removed the default value { \"@\": \"./src\"} provided\nby alias.\n\nIf you need this feature, please use resolve.alias and avoid mixing it with\nalias.\n\nIn the next major version, resolve.alias will replace alias.\n\n\nresolve.mainFields#\n\nA list of fields in package.json to try when parsing the package entry point.\n\n * Type: string[]\n * Default: depends on platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * Version: >=2.36.0\n\nFor example, we want to load the js:source field first:\n\n\n\nWARNING\n\nresolve.mainFields has a lower priority than the exports field in package.json,\nand if an entry point is successfully resolved from exports, resolve.mainFields\nwill be ignored.\n\n\nresolve.jsExtentions#\n\nSupport for implicit file extensions\n\n * Type: string[]\n * Default: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * Version: >=2.36.0\n\nDo not use implicit file extensions for css files, currently Module only\nsupports ['.less', '.css', '.sass', '.scss'] suffixes.\n\nNode's parsing algorithm does not consider .mjs and cjs as implicit file\nextensions, so they are not included here by default, but can be included by\nchanging this configuration:\n\n\n\n\nshims#\n\nWhen building CommonJS/ESM artifacts, inject some polyfill code such as\n__dirname which can only be used in CommonJS. After enable this option, it will\ncompile __dirname as path.dirname(fileURLToPath(import.meta.url)) when format is\nesm.\n\nSee details here, Note that esm shims will only be injected if platform is node,\nbecause the url module is used.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\n\n\n\nsideEffects#\n\nModule sideEffects\n\n * Type: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * Default: undefined\n\nNormally, we configure the module's side effects via the sideEffects field in\npackage.json, but in some cases, The package.json of a third-party package is\nunreliable.Such as when we reference a third-party package style file\n\n\n\nBut the package.json of this third-party package does not have the style file\nconfigured in the sideEffects\n\n\n\nAt the same time you set style.inject to true and you will see a warning message\nlike this in the console\n\n\n\nAt this point, you can use this configuration option to manually configure the\nmodule's \"sideEffects\" to support regular and functional forms.\n\n\n\nTIP\n\nAfter adding this configuration, the sideEffects field in package.json will no\nlonger be read when packaging\n\n\nsourceDir#\n\nSpecify the source directory of the build, default is src, which is used to\ngenerate the corresponding output directory based on the source directory\nstructure when building bundleless. Same as esbuild.outbase.\n\n * Type: string\n * Default: src\n\n\nsourceMap#\n\nWhether to generate sourceMap or not\n\n * Type: boolean | 'inline' | 'external'\n * Default: false\n\n\nsourceType#\n\nSets the format of the source code. By default, the source code will be treated\nas EsModule. When the source code is using CommonJS, you need to set commonjs.\n\n * Type: 'commonjs' | 'module'\n * Default: 'module'\n\n\nsplitting#\n\nWhether to enable code splitting. Only support format: 'esm' and format:\n'cjs',see esbuild.splitting learn more.\n\n * Type: boolean\n * Default: false\n\n\nstyle#\n\nConfigure style-related configuration\n\n\nstyle.less#\n\nless-related configuration\n\n\nstyle.less.lessOptions#\n\nRefer to less for detailed configuration\n\n * Type: object\n * Default: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\nAdd Less code to the beginning of the entry file.\n\n * Type: string\n * Default: undefined\n\n\n\n\nstyle.less.implementation#\n\nConfigure the implementation library used by Less, if not specified, the\nbuilt-in version used is 4.1.3.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Less when the object type is specified.\n\n\n\nFor the string type, specify the path to the implementation library for Less\n\n\n\n\nstyle.sass#\n\nsass-related configuration.\n\n\nstyle.sass.sassOptions#\n\nRefer to node-sass for detailed configuration.\n\n * Type: object\n * Default: {}\n\n\nstyle.sass.additionalData#\n\nAdd Sass code to the beginning of the entry file.\n\n * Type: string | Function\n * Default: undefined\n\n\n\n\nstyle.sass.implementation#\n\nConfigure the implementation library used by Sass, the built-in version used is\n1.5.4 if not specified.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Sass when the object type is specified.\n\n\n\nFor the string type, specify the path to the Sass implementation library\n\n\n\n\nstyle.postcss#\n\nUsed to configure options for PostCSS. The provided values will be merged with\nthe default configuration using Object.assign. Note that Object.assign performs\na shallow copy, so it will completely override the built-in plugins array.\n\nFor detailed configuration, please refer to PostCSS.\n\n * Type:\n\n\n\n * Default:\n\n\n\n * Example:\n\n\n\n\nstyle.inject#\n\nConfigure whether to insert CSS styles into JavaScript code in bundle mode.\n\n * Type: boolean\n * Default: false\n\nSet inject to true to enable this feature:\n\n\n\nOnce enabled, you will see the CSS code referenced in the source code included\nin the bundled JavaScript output.\n\nFor example, if you write import './index.scss' in the source code, you will see\nthe following code in the output:\n\n\n\nTIP\n\nAfter enabling inject, you need to pay attention to the following points:\n\n * @import in CSS files will not be processed. If your CSS file contains\n @import, you need to manually import the CSS file in the JS file (less and\n scss files are not required because they have preprocessing).\n * Consider the impact of sideEffects. By default, our builder assumes that CSS\n has side effects. If the sideEffects field is set in your project or\n third-party package's package.json and does not include this CSS file, you\n will receive a warning:\n\n\n\nYou can resolve this by configuring sideEffects.\n\n\nstyle.autoModules#\n\nEnable CSS Modules automatically based on the filename.\n\n * Type: boolean | RegExp\n * Default: true\n\ntrue : Enables CSS Modules for style files ending with .module.css .module.less\n.module.scss .module.sass filenames\n\nfalse : Disable CSS Modules.\n\nRegExp : Enables CSS Modules for all files that match the regular condition.\n\n\nstyle.modules#\n\nCSS Modules configuration\n\n * Type: object\n * Default: {}\n\nA common configuration is localsConvention, which changes the class name\ngeneration rules for css modules\n\n\n\nFor the following styles\n\n\n\nYou can use styles.boxTitle to access\n\nFor detailed configuration see postcss-modules\n\n\nstyle.tailwindcss#\n\nUsed to modify the configuration of Tailwind CSS.\n\n * Type: object | Function\n * Default:\n\n\n\n\nEnabling Tailwind CSS#\n\nBefore using style.tailwindcss, you need to enable the Tailwind CSS plugin for\nModern.js Module.\n\nPlease refer to the section Using Tailwind CSS for instructions on how to enable\nit.\n\n\nType#\n\nWhen the value is of type object, it is merged with the default configuration\nvia Object.assign.\n\nWhen the value is of type Function, the object returned by the function is\nmerged with the default configuration via Object.assign.\n\nThe rest of the usage is the same as Tailwind CSS: Quick Portal.\n\n\nNotes#\n\nPlease note that:\n\n * If you are using both the tailwind.config.{ts,js} file and tools.tailwindcss\n option, the configuration defined in tools.tailwindcss will take precedence\n and override the content defined in tailwind.config.{ts,js}.\n * If you are using the designSystem configuration option simultaneously, the\n theme configuration of Tailwind CSS will be overridden by the value of\n designSystem.\n\nThe usage of other configurations follows the same approach as the official\nusage of Tailwind CSS. Please refer to tailwindcss - Configuration for more\ndetails.\n\n\ntarget#\n\ntarget is used to set the target environment for the generated JavaScript code.\nIt enables Modern.js Module to transform JavaScript syntax that is not\nrecognized by the target environment into older versions of JavaScript syntax\nthat are compatible with these environments.\n\n * Type:\n\n\n\n * Default: 'es6'\n\nFor example, compile the code to es5 syntax:\n\n\n\n\ntransformImport#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\nWith this configuration, the code will be converted using SWC.\n\n * Type: object[]\n * Default: []\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\nReference the Import Plugin - Notes\n\n\ntransformLodash#\n\nSpecifies whether to modularize the import of lodash and remove unused lodash\nmodules to reduce the code size of lodash.\n\nThis optimization is implemented using babel-plugin-lodash and swc-plugin-lodash\nunder the hood.\n\nWith this configuration, the code will be converted using SWC.\n\n * Type: boolean\n * Default: false\n\nWhen you enable this, Modern.js Module will automatically redirects the code\nreferences of lodash to sub-paths.\n\nFor example:\n\n\n\nThe transformed code will be:\n\n\n\n\ntsconfig#\n\nPath to the tsconfig file\n\n * Type: string\n * Default: tsconfig.json\n * Version: >=2.36.0\n\n\n\n\numdGlobals#\n\nSpecify global variables for external import of umd artifacts\n\n * Type: Record\n * Default: {}\n\n\n\nAt this point, react and react-dom will be seen as global variables imported\nexternally and will not be packed into the umd product, but will be accessible\nby way of global.React and global.ReactDOM\n\n\numdModuleName#\n\nSpecifies the module name of the umd product\n\n * Type: string | Function\n * Default: name => name\n\n\n\nAt this point the umd artifact will go to mount on global.myLib\n\n:::tip\n\n * The module name of the umd artifact must not conflict with the global\n variable name.\n * Module names will be converted to camelCase, e.g. my-lib will be converted to\n myLib, refer to toIdentifier. :::\n\nAlso the function form can take one parameter, which is the output path of the\ncurrent package file\n\n","routePath":"/module-tools/en/api/config/build-config","lang":"en","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":378},{"text":"asset","id":"asset","depth":2,"charIndex":1054},{"text":"asset.name","id":"assetname","depth":2,"charIndex":1113},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":1571},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":2045},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":2149},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":2336},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":2783},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":2901},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":3018},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":3299},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":4498},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":5006},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":5142},{"text":"banner","id":"banner","depth":2,"charIndex":5273},{"text":"buildType","id":"buildtype","depth":2,"charIndex":5514},{"text":"copy","id":"copy","depth":2,"charIndex":5674},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":5850},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":5908},{"text":"define","id":"define","depth":2,"charIndex":6133},{"text":"dts","id":"dts","depth":2,"charIndex":7312},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":7435},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":7919},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":8081},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":8508},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":8664},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":8793},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":9225},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":10401},{"text":"externals","id":"externals","depth":2,"charIndex":10923},{"text":"footer","id":"footer","depth":2,"charIndex":11113},{"text":"format","id":"format","depth":2,"charIndex":11209},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":11396},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":11536},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":11732},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":12026},{"text":"hooks","id":"hooks","depth":2,"charIndex":12329},{"text":"input","id":"input","depth":2,"charIndex":12816},{"text":"jsx","id":"jsx","depth":2,"charIndex":13845},{"text":"metafile","id":"metafile","depth":2,"charIndex":14376},{"text":"minify","id":"minify","depth":2,"charIndex":14805},{"text":"outDir","id":"outdir","depth":2,"charIndex":14948},{"text":"platform","id":"platform","depth":2,"charIndex":15042},{"text":"redirect","id":"redirect","depth":2,"charIndex":15273},{"text":"resolve","id":"resolve","depth":2,"charIndex":15789},{"text":"resolve.alias","id":"resolvealias","depth":3,"charIndex":15834},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":16509},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":17002},{"text":"shims","id":"shims","depth":2,"charIndex":17467},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":17888},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":18737},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":18995},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":19106},{"text":"splitting","id":"splitting","depth":2,"charIndex":19333},{"text":"style","id":"style","depth":2,"charIndex":19496},{"text":"style.less","id":"styleless","depth":2,"charIndex":19544},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":19586},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":19711},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":19832},{"text":"style.sass","id":"stylesass","depth":2,"charIndex":20177},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":20220},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":20326},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":20458},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":20798},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":21146},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":22159},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":22506},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":22806},{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":3,"charIndex":22920},{"text":"Type","id":"type","depth":3,"charIndex":23129},{"text":"Notes","id":"notes","depth":3,"charIndex":23434},{"text":"target","id":"target","depth":2,"charIndex":24017},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":24381},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":24737},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":25238},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":25343},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":25654}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":1,"title":"buildPreset","content":"#\n\nA build preset string or preset function. Provides out-of-the-box build\nconfiguration\n\n * Type: string | Function\n\n\nnpm-library#\n\nLibrary generic schema used under class NPM package manager, contains esm and\ncjs bundle artifacts, and includes a type file.\n\nINFO\n\nAbout the class NPM Package Manager\n\n * npm\n * yarn\n * pnpm\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-library-with-umd#\n\nUsed under class NPM package manager, and Library supports a similar pattern to\nunpkg. Additional umd artifacts are provided on top of the pre-defined\nnpm-library.\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-component#\n\nA generic pattern for components (libraries) used under the class NPM package\nmanager. Contains both esm and cjs Bundleless artifacts (for easy Tree shaking\noptimization), as well as including a copy of the type file.\n\nFor style files included in the source code, the artifacts provide the compiled\nfiles of the style and the source file of the style.\n\n\n\nThe pre-defined strings correspond to the build configuration.\n\n\n\n\nnpm-component-with-umd#\n\nComponent (library) used under class NPM package manager, with support for class\nunpkg schema. Additional umd artifacts are provided on top of the pre-defined\nnpm-component.\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\nWhen you want to use a buildPreset preset that supports other ECMAScript\nversions, you can directly add the supported versions to the 'npm-library',\n'npm-library-with-umd', 'npm-component', 'npm-component-with-umd' presets.\n\nFor example, if you want the 'npm-library' preset to support 'es2017', you can\nconfigure it as follows.\n\n\n\n\nstring / function#\n\nThe buildPreset not only supports basic string forms, but also function forms,\nwhich can obtain the default values we provide through the preset or extend\nPreset parameter and then modify them.\n\nHere are two examples using preset and extend Preset:\n\n\n\nIn the extend Preset, lodash.merge is used for configuration merge.\n\n","routePath":"/module-tools/en/api/config/build-preset","lang":"en","toc":[{"text":"`npm-library`","id":"npm-library","depth":3,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":3,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":3,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":3,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":3,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":1651}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":2,"title":"dev","content":"#\n\nThis section describes all configuration of Modern.js Module related to\ndebugging tools.\n\n\nstorybook#\n\nWARNING\n\nDeprecated: This configuration is deprecated and only applicable to Storybook\nV6. Please see 使用Storybook to get more info.\n\n\nstorybook.webpack#\n\n * Type: object | Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpack. The usage can be found in the tools.webpack configuration\nof Modern.js Builder.\n\n\n\nConfigure Manager App#\n\nFor the webpack configuration of the Storybook Manager app section, you can\nconfigure it by adding the ./config/storybook/main.js file to configure it.\n\n\n\n\nstorybook.webpackChain#\n\n * Type: Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpackChain. You can refer to Modern.js Builder's\ntools.webpackChain configuration for how to use it.","routePath":"/module-tools/en/api/config/dev","lang":"en","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":93},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":239},{"text":"Configure Manager App","id":"configure-manager-app","depth":4,"charIndex":506},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":686}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":3,"title":"plugins","content":"#\n\nThis chapter describes the configuration of the registered Modern.js Module\nplugin.\n\n * Type: ModuleToolsPlugin[]\n * Default: undefined\n\n\nPlugin Execution Order#\n\nBy default, custom plugins are executed in the order specified in the plugins\narray. The execution of built-in plugins provided by Modern.js Module happens\nbefore the execution of custom plugins.\n\nWhen plugins use fields that control the execution order, such as pre and post,\nthe execution order is adjusted based on the declared fields. For more\ninformation, please refer to the Relationship Between Plugins guide.\n\n\nDeveloping Plugins#\n\nTo learn how to write plugins, please refer to the Plugin Writing Guide.\n\n\nExample#\n\n\nUsing Plugins from npm#\n\nTo use plugins from npm, you need to install them using a package manager and\nimport them in your configuration file.\n\n\n\nUsing Local Plugins#\n\nTo use plugins from a local code repository, you can directly import them using\na relative path.\n\n\n\n\nPlugin Configuration#\n\nIf a plugin provides custom configuration options, you can pass the\nconfiguration through the plugin function's parameters.\n\n","routePath":"/module-tools/en/api/config/plugins","lang":"en","toc":[{"text":"Plugin Execution Order","id":"plugin-execution-order","depth":2,"charIndex":140},{"text":"Developing Plugins","id":"developing-plugins","depth":2,"charIndex":584},{"text":"Example","id":"example","depth":2,"charIndex":680},{"text":"Using Plugins from npm","id":"using-plugins-from-npm","depth":3,"charIndex":691},{"text":"Using Local Plugins","id":"using-local-plugins","depth":4,"charIndex":837},{"text":"Plugin Configuration","id":"plugin-configuration","depth":3,"charIndex":960}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":4,"title":"Overview","content":"#","routePath":"/module-tools/en/api/","lang":"en","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"Overview","sidebar_position":1},"version":""},{"id":5,"title":"Plugin Hooks","content":"#\n\nThis chapter describes the lifecycle hooks supported by module-tools.\n\nCurrently there are following main types of lifecycle hooks.\n\n * Config hooks: change user config.\n * Build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * dev hooks: hooks that are triggered when running the dev command.\n\nHook Model is explained in detail here.\n\n\nConfig hooks#\n\n\nresolveModuleUserConfig#\n\nchang user config.\n\ntype: AsyncWaterfall\n\n\n\n\nbuild hooks#\n\nThe following Hooks are triggered in order when the build command is executed.\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\nTriggered before the execution of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters value types.\n\n\n\n> BuildConfig type reference API configuration\n\n\nbeforeBuildTask#\n\nBased on the build configuration, Modern.js Module will split the overall build\ninto multiple sub-build tasks. The Hook will be triggered before each build\nsubtask.\n\ntype: AsyncWaterfall\n\n\n\nParameters and return value types.\n\nBaseBuildConfig type reference API configuration\n\n\nafterBuildTask#\n\nTriggered after the end of each build subtask.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nafterBuild#\n\nTriggered after the end of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nbuildPlatform hooks#\n\nmodule-tools also provides the build --platform command to perform specific\nbuild tasks.\n\nFor example, after installing the Module Doc plugin, you can run build\n--platform or build --platform doc to perform Doc build tasks.\n\nHooks are triggered in the following order after executing build --platform.\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\nGets information about the tasks that need to be run when executing the build\n--platform command.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeBuildPlatform#\n\nTriggers all registered build tasks when the build --platform command is\nexecuted. beforeBuildPlatform will be triggered before the execution of the\noverall build task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. buildPlatform will be triggered before each build task is\nexecuted.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterBuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. afterBuildPlatform will be triggered after the overall platform\nbuild task is finished.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nDev Hooks#\n\nThe following Hooks are triggered in order when the dev command is executed.\n\n * registerDev: triggered when getting dev function information.\n * beforeDev: Triggered before starting the dev process as a whole.\n * beforeDevMenu: triggered before the dev list/menu appears.\n * afterDevMenu: triggered after dev list/menu option is selected.\n * beforeDevTask: Triggered before executing the dev task.\n * afterDev: Triggered at the end of the overall dev process.\n\n\nregisterDev#\n\nRegister dev tool related data. Mainly contains.\n\n * the name of the dev tool\n * The name of the item displayed in the menu list and the corresponding value.\n * The definition of the dev subcommand.\n * Whether to execute the source code build before running the dev task\n * The function to execute the dev task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDev#\n\nTriggered before the dev task is executed after all dev tool metadata has been\ncollected.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu is triggered before the dev list/menu appears. Receives inquirer\nquestion as argument. Default value is.\n\n\n\nafterDevMenu Triggered after selecting dev list/menu options.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDevTask#\n\nTriggered before the dev task is executed.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterDev#\n\nTriggered when the dev task process is interrupted.\n\n","routePath":"/module-tools/en/api/plugin-api/plugin-hooks","lang":"en","toc":[{"text":"Config hooks","id":"config-hooks","depth":2,"charIndex":509},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"build hooks","id":"build-hooks","depth":2,"charIndex":596},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform hooks","id":"buildplatform-hooks","depth":2,"charIndex":1494},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"Dev Hooks","id":"dev-hooks","depth":2,"charIndex":2796},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":6,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-exception","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":7,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-other","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":8,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-product","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":9,"title":"","content":"","routePath":"/module-tools/en/components/faq-storybook","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":10,"title":"","content":"","routePath":"/module-tools/en/components/publish-emo","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":11,"title":"","content":"When adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.","routePath":"/module-tools/en/components/register-esbuild-plugin","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":12,"title":"","content":"","routePath":"/module-tools/en/components/release-module-doc","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":13,"title":"Handle static assets","content":"#\n\nModern.js Module will handle static assets used in the code. If configuration is\nrequired, then the buildConfig.asset API can be used.\n\n\nDefault behavior#\n\nBy default, Modern.js Module handles the following static assets:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\nFor the handling of static files, Modern.js Module currently supports the\nfollowing functions.\n\n * Set the static asset path to . /assets.\n * Files less than 10kb will be inlined into the code.\n\n\nExample#\n\nLet us look at the following example:\n\n * Project source code:\n\n\n\n * If the size of bg.png is less than 10 kb, then the output directory structure\n and file content are.\n\n\n\n\n\n * If the size of bg.png is larger than 10 kb, then the output directory\n structure and file content are.\n\n\n\n\n\nWhen wanting to modify the default behavior, the following API can be used:\n\n * asset.path: modify the output path of the static assets.\n * asset.limit: modify the threshold value for inline assets.","routePath":"/module-tools/en/guide/advance/asset","lang":"en","toc":[{"text":"Default behavior","id":"default-behavior","depth":2,"charIndex":139},{"text":"Example","id":"example","depth":2,"charIndex":571}],"domain":"","frontmatter":{"sidebar_position":6},"version":""},{"id":14,"title":"Build umd artifacts","content":"#\n\nThe full name of umd is Universal Module Definition, and JS files in this format\ncan run in multiple runtime environments: the\n\n * Browser environment: module loading based on AMD specification\n * Node.js environment: module loading based on CommonJS\n * Other cases: mount the module on a global object.\n\nWe can therefore specify the build artifacts of the project as an umd artifact\nin the following way:\n\n\n\n\nThird-party dependency handling for umd artifacts#\n\nIn the \"How to handle third-party dependencies\" chapter, we know that we can\ncontrol whether or not the project packages third-party dependencies via the\nautoExternals and externals APIs. So when building umd artifacts, we can also\nuse it like this:\n\n\nExample#\n\n * If the project depends on react:\n\n\n\n * modern.config.ts:\n\n\n\n * When a react dependency is used in the source code:\n\n\n\n * The react code is not bundled into the artifact at this point:\n\n\n\nWe know from the above example that when using the autoExternal and externals\nAPIs.\n\n * In a Node.js environment, you can get the react dependency with\n require('react').\n * In a browser environment, you can get the react dependency via global.react.\n\n\nGlobal variable names of third-party dependencies#\n\nHowever, in the browser environment, when getting third-party dependencies,\nglobal variable names are not necessarily identical to the dependency names, so\nyou have to use the buildConfig.umdGlobals API.\n\nAgain using the previous example, when the react dependency exists in the\nbrowser environment as a windows.React or global.React global variable, then:\n\n * modern.config.ts config file:\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nAt this point we will see the output code like this:\n\n\n\nThe project can then run in the browser and use the React variables that exist\non the global object.\n\n\nChanging the name of a global variable in a project#\n\nWhen we package the following code into an umd artifact and run it in the\nbrowser, we can use the module via window.index.\n\n\n\n** By default, the name of the source file is used as the name of the module's\nglobal variable in the browser. **For the above example, the artifact would read\nas follows:\n\n\n\nIf you need to modify it, you need to use the buildConfig.umdModuleName API.\n\nWhen this API is used:\n\n\n\nThe build artifact at this point are:\n\n","routePath":"/module-tools/en/guide/advance/build-umd","lang":"en","toc":[{"text":"Third-party dependency handling for umd artifacts","id":"third-party-dependency-handling-for-umd-artifacts","depth":2,"charIndex":412},{"text":"Example","id":"example","depth":3,"charIndex":716},{"text":"Global variable names of third-party dependencies","id":"global-variable-names-of-third-party-dependencies","depth":3,"charIndex":1171},{"text":"Changing the name of a global variable in a project","id":"changing-the-name-of-a-global-variable-in-a-project","depth":2,"charIndex":1831}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":15,"title":"Use the Copy Tools","content":"#\n\nModern.js Module provides the Copy utility for copying already existing\nindividual files or entire directories into the output directory. Next we learn\nhow to use it.\n\n\nUnderstanding the Copy API#\n\nWe can use the Copy tool via the buildConfig.copy API, which contains the\nfollowing two main configurations.\n\n * patterns\n * options\n\n\nAPI Description#\n\ncopy.patterns is used to find files to be copied and configure the output path.\n\nThe patterns.from parameter is used to specify the file or directory to be\ncopied. It accepts either a Glob pattern string or a specific path. A Glob\npattern string refers to the fast-glob pattern syntax. Therefore, we can use it\nin two ways as follows:\n\n\n\nThe patterns.context parameter is generally used in conjunction with\npatterns.from. By default, its value is the same as buildConfig.sourceDir.\nTherefore, we can specify the file src/data.json to be copied in the following\nway:\n\n> By default, buildConfig.sourceDir is set to src.\n\n\n\nWhen the specified file is not in the source code directory, you can modify the\ncontext configuration. For example, to specify the file temp/index.html in the\nproject directory to be copied:\n\n\n\nThe patterns.to parameter is used to specify the output path for the copied\nfiles. By default, its value corresponds to buildConfig.outDir. Therefore, we\ncan copy src/index.html to the dist directory as follows:\n\n\n\nWhen we configure patterns.to:\n\n * If it is a relative path, the path will be calculated relative to\n buildConfig.outDir to determine the absolute path for copying the files.\n * If it is an absolute path, the value will be used directly.\n\nFinally, patterns.globOptions is used to configure the globby object for finding\nfiles to copy. Its configuration can be referenced from:\n\n * globby.options\n\n\nExamples of Different Scenarios#\n\n\nCopying Files#\n\n\n\n\nCopying Files to a Directory#\n\n\n\n\nCopying from Directory to Directory#\n\n\n\n\nCopying from Directory to File#\n\n\n\n\nUsing Glob#\n\n","routePath":"/module-tools/en/guide/advance/copy","lang":"en","toc":[{"text":"Understanding the Copy API","id":"understanding-the-copy-api","depth":2,"charIndex":171},{"text":"API Description","id":"api-description","depth":2,"charIndex":335},{"text":"Examples of Different Scenarios","id":"examples-of-different-scenarios","depth":2,"charIndex":1783},{"text":"Copying Files","id":"copying-files","depth":3,"charIndex":1818},{"text":"Copying Files to a Directory","id":"copying-files-to-a-directory","depth":3,"charIndex":1837},{"text":"Copying from Directory to Directory","id":"copying-from-directory-to-directory","depth":3,"charIndex":1871},{"text":"Copying from Directory to File","id":"copying-from-directory-to-file","depth":3,"charIndex":1912},{"text":"Using Glob","id":"using-glob","depth":3,"charIndex":1948}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":16,"title":"Handle third-party dependencies","content":"#\n\nGenerally, third-party dependencies required by a project can be installed via\nthe install command in the package manager. After the third-party dependencies\nare successfully installed, they will generally appear under dependencies and\ndevDependencies in the project package.json.\n\n\n\nDependencies under \"dependencies\" are generally related to project code and\nbuilds, and if these third-party dependencies are declared under\n\"devDependencies\", then there will be missing dependencies in production\nenvironments.\n\nIn addition to \"dependencies\", \"peerDependencies\" can also declare dependencies\nthat are needed in the production environment, but it puts more emphasis on the\nexistence of these dependencies declared by \"peerDependencies\" in the project's\nruntime environment, similar to the plugin mechanism.\n\n\nDefault handling of third-party dependencies#\n\nBy default, third-party dependencies under \"dependencies\" and \"peerDependencies\"\nare not bundled by Modern.js Module.\n\nThis is because when the npm package is installed, its \"dependencies\" will also\nbe installed. By not packaging \"dependencies\", you can reduce the size of the\npackage product.\n\nIf you need to package some dependencies, it is recommended to move them from\n\"dependencies\" to \"devDependencies\", which is equivalent to prebundle the\ndependencies and reduces the size of the dependency installation.\n\n\nExample#\n\nIf the project has a dependency on react.\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nThe react code is not bundled into the artifact:\n\n\n\nIf you want to modify the default processing, you can use the following API.\n\n * buildConfig.autoExternal\n\n\nExclude specified third-party dependencies#\n\nWe mentioned above the use of the buildConfig.autoExternal API, and\nbuildConfig.externals can control which third-party dependencies to handle the\nproject's dependencies in a more granular way.\n\nFor example, when we need to leave only certain dependencies unpacked, we can\nconfigure it as follows.\n\n> In this case, it is likely that some dependencies are not suitable for\n> packaging. If this is the case, then you can handle it as follows.\n\n","routePath":"/module-tools/en/guide/advance/external-dependency","lang":"en","toc":[{"text":"Default handling of third-party dependencies","id":"default-handling-of-third-party-dependencies","depth":2,"charIndex":811},{"text":"Example","id":"example","depth":3,"charIndex":1373},{"text":"Exclude specified third-party dependencies","id":"exclude-specified-third-party-dependencies","depth":2,"charIndex":1643}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":17,"title":"In-depth understanding of build","content":"#\n\nIn the \"Basic Usage\" section, we already knew that you can modify the output\nfiles of a project through the buildConfig configuration. buildConfig not only\ndescribes some of the features of the product, but also provides some\nfunctionality for building the product.\n\nTIP\n\nIf you are not familiar with buildConfig, please read modify-output-product.\n\nIn this chapter we'll dive into the use of certain build configurations and\nunderstand what happens when the modern build command is executed.\n\n\nbundle / bundleless#\n\nSo first let's understand bundle and bundleless.\n\nA bundle is a package of build artifacts, which may be a single file or multiple\nfiles based on a certain code splitting strategy.\n\nbundleless, on the other hand, means that each source file is compiled and built\nseparately, but not bundled together. Each output file can be found with its\ncorresponding source code file. The process of bundleless build can also be\nunderstood as the process of code conversion of source files only.\n\nThey have their own benefits.\n\n * bundle can reduce the size of build artifacts and also pre-package\n dependencies to reduce the size of installed dependencies. Packaging\n libraries in advance can speed up application project builds.\n * bundleless maintains the original file structure and is more conducive to\n debugging and tree shaking.\n\nWARNING\n\nbundleless is a single-file compilation mode, so for referencing and exporting\ntypes, you need to add the type keyword. For example, ``. Please refer to the\nesbuild documentation for more information.\n\nIn buildConfig you can specify whether the current build task is bundle or\nbundleless by using buildConfig.buildType.\n\n\ninput / sourceDir#\n\nbuildConfig.input is used to specify the path to a file or directory from which\nto read the source code, the default value of which varies between bundle and\nbundleless builds:\n\n * When buildType: 'bundle', input defaults to src/index.(j|t)sx?.\n * When buildType: 'bundleless', input defaults to ['src'].\n\nFrom the default value, we know that building in bundle mode usually specifies\none or more files as the entry point for the build, while building in bundleless\nmode specifies a directory and uses all the files in that directory as the entry\npoint.\n\nsourceDir is used to specify the source directory, which is only related to the\nfollowing two elements:\n\n * Type file generation\n * outbase for specifying the build process\n\nSo we can get its best practices:\n\n * Only specify input during the bundle build.\n * In general, bundleless only needs to specify sourceDir (where input will be\n aligned with sourceDir). If we want to use the input in bundleless, we only\n need to specify sourceDir.\n\nIf you want to convert only some of the files in bundleless, e.g. only the files\nin the src/runtime directory, you need to configure input:\n\n\n\n\nuse swc#\n\nIn some scenarios, esbuild is not enough to meet our needs, and we will use swc\nto do the code conversion.\n\nStarting from version 2.36.0, the Modern.js Module will use swc by default when\nit comes to the following functionality, but that doesn't mean we don't use\nesbuild any more, the rest of the functionality will still use esbuild.\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\nIn fact, we've been using swc for full code conversion since version 2.16.0.\nHowever, swc also has some limitations, so we added sourceType to turn off swc\nwhen the source is formatted as 'commonjs', which isn't really user-intuitive,\nand the cjs mode of the swc formatted outputs don't have annotate each export\nname, which can cause problems in node. So we deprecated this behaviour and went\nback to the original design - using swc as a supplement only in situations where\nit was needed.\n\n\nUsing Hooks to Intervene in the Build Process#\n\nThe Modern.js Module provides a Hook mechanism that allows us to inject custom\nlogic at different stages of the build process. The Modern.js Module Hook is\nimplemented using tapable, which extends esbuild's plugin mechanism, and is\nrecommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:\n\n\nHook type#\n\nAsyncSeriesBailHook#\n\nSerial hooks that stop the execution of other tapped functions if a tapped\nfunction returns a non-undefined result.\n\nAsyncSeriesWaterFallHooks#\n\nSerial hooks whose results are passed to the next tapped function.\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * Triggered at esbuild onLoad callbacks to fetch module content based on the\n module path\n * Input parameters\n\n\n\n * Return parameters\n\n\n\n * Example\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onLoad callbacks. Transforms the contents of the module\n fetched during the load phase\n * Input parameters (return parameters)\n\n\n\n * Example\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onEnd callbacks. This is similar to the transform hook,\n but works on the artifacts generated by esbuild.\n * Input parameters (return parameters)\n\n\n\n * Examples\n\n\n\n\ndts#\n\nThe buildConfig.dts configuration is mainly used for type file generation.\n\n\nTurn off type generation#\n\nType generation is turned on by default, if you need to turn it off, you can\nconfigure it as follows:\n\n\n\nTIP\n\nThe build speed is generally improved by closing the type file.\n\n\nBuild type files#\n\nWith buildType: 'bundleless', type files are generated using the project's tsc\ncommand to complete production.\n\nThe Modern.js Module also supports bundling of type files, although care needs\nto be taken when using this feature.\n\n * Bundle type files does not enable type checking.\n * Some third-party dependencies have incorrect syntax that can cause the\n bundling process to fail. So in this case, you need to exclude such\n third-party packages manually with buildConfig.externals or close\n dts.respectExternal to external all third-party packages types.\n * It is not possible to handle the case where the type file of a third-party\n dependency points to a .ts file. For example, the package.json of a\n third-party dependency contains something like this: {\"types\": \".\n /src/index.ts\"}.\n\nFor the above problems, our recommended approach is to first use tsc to generate\nd.ts files, then package the index.d.ts as the entry and close\ndts.respectExternal. In the future evolution, we will gradually move towards\nthis handling approach.\n\n\nAlias Conversion#\n\nDuring the bundleless build process, if an alias appears in the source code,\ne.g.\n\n\n\nThe type files generated with tsc will also contain these aliases. However,\nModern.js Module will convert the aliases in the type file generated by tsc.\n\n\nSome examples of the use of dts#\n\nGeneral usage:\n\n\n\nFor the use of dts.only:\n\n\n\n\nBuild process#\n\nWhen the modern build command is executed, the\n\n * Clear the output directory according to buildConfig.outDir.\n * Compile js/ts source code to generate the JS build artifacts for\n bundle/bundleless.\n * Generate bundle/bundleless type files using tsc.\n * Handle Copy tasks.\n\n\nBuild errors#\n\nWhen a build error occurs, based on the information learned above, it is easy to\nunderstand what error appears in the terminal.\n\nErrors reported for js or ts builds:\n\n\n\nErrors reported for the type file generation process:\n\n\n\nFor js/ts build errors, we can tell from the error message.\n\n * By 'bundle failed:' to determine if the error is reported for a bundle build\n or a bundleless build\n * What is the format of the build process\n * What is the target of the build process\n * The specific error message\n\n\nDebug mode#\n\nFrom 2.36.0, For troubleshooting purposes, the Modern.js Module provides a debug\nmode, which you can enable by adding the DEBUG=module environment variable when\nexecuting a build.\n\n\n\nIn debug mode, you'll see more detailed build logs output in Shell, which are\nmainly process logs:\n\n\n\nIn addition, Module provides the ability to debug internal workflows. You can\nenable more detailed debugging logging by setting the DEBUG=module:* environment\nvariable.\n\nCurrently, only DEBUG=module:resolve is supported, which allows you to see a\ndetailed log of module resolution within the Module.\n\n","routePath":"/module-tools/en/guide/advance/in-depth-about-build","lang":"en","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"use swc","id":"use-swc","depth":2,"charIndex":2845},{"text":"Using Hooks to Intervene in the Build Process","id":"using-hooks-to-intervene-in-the-build-process","depth":2,"charIndex":3803},{"text":"Hook type","id":"hook-type","depth":3,"charIndex":4183},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":4195},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":4334},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":4431},{"text":"load","id":"load","depth":4,"charIndex":4442},{"text":"transform","id":"transform","depth":4,"charIndex":4626},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":4837},{"text":"dts","id":"dts","depth":2,"charIndex":5071},{"text":"Turn off type generation","id":"turn-off-type-generation","depth":3,"charIndex":5154},{"text":"Build type files","id":"build-type-files","depth":3,"charIndex":5357},{"text":"Alias Conversion","id":"alias-conversion","depth":3,"charIndex":6424},{"text":"Some examples of the use of `dts`","id":"some-examples-of-the-use-of-dts","depth":3,"charIndex":-1},{"text":"Build process","id":"build-process","depth":2,"charIndex":6764},{"text":"Build errors","id":"build-errors","depth":2,"charIndex":7057},{"text":"Debug mode","id":"debug-mode","depth":2,"charIndex":7582}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":18,"title":"In-depth understanding of the dev command","content":"#\n\nThe dev command provided by the Modern.js Module is mainly used for debugging\nthe code.\n\n\nThe overall flow of the command run#\n\n 1. When the dev command is executed, Modern.js Module starts looking for\n debugging tools or tasks that can be executed. A debugging tool or task is a\n Modern.js Module debugging tool plugin like module doc.\n 2. When a debugging tool is found, it is executed immediately.\n 3. When multiple debugging tools are found, the debugging tools list menu is\n displayed. A debug tool can be started by selecting the name option\n corresponding to it.\n 4. When no debug tool is found, the user is informed that no debug tool is\n available.\n\nIn addition to the dev command, you can also start a debugging tool or task\ndirectly by using the dev [debug tool name] option.\n\n\nExtending the dev command#\n\nIf you need to extend the dev command, or rather provide your own Modern.js\nModule debugging tool plugin, then you will need to know the following first.\n\n * Development of plugins\n * Debugging Tools Plugin API\n\nIn general, the code to implement a debugging tool that does nothing and the\nassociated configuration is as follows.\n\n\n\nIf this debugging tool plugin is required, it needs to be added to the\nconfiguration file.\n\n\n\nAt this point we can execute it when we execute the dev or dev do-nothing\ncommand. After execution, it will first execute the source build task in\nlistening mode and print the log messages immediately afterwards.\n\nFor currently officially supported debugging tools and third-party supported\ndebugging tools, you can view them in plugins list.","routePath":"/module-tools/en/guide/advance/in-depth-about-dev-command","lang":"en","toc":[{"text":"The overall flow of the command run","id":"the-overall-flow-of-the-command-run","depth":2,"charIndex":92},{"text":"Extending the dev command","id":"extending-the-dev-command","depth":2,"charIndex":806}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":19,"title":"Before you start","content":"#\n\n\nEnvironment preparation#\n\nIn order to use the Modern.js Module, you first need NodeJS engine, we recommend\nthe latest LTS version, and make sure the Node version is >=16.0.0. because\nnon-stable NodeJS releases frequently have bugs. You might consider installing\nvia nvm-windows and nvm (Mac / Linux), so you can easily switch to different\nNodeJS versions that might be required for different projects that you work on.\n\n\nGetting Started with npm#\n\nOnce NodeJS is installed, not only can you access the node executable from the\ncommand line, but you can also execute the npm command.\n\nNpm is the standard package manager for NodeJS. It started out as a tool for\ndownloading and managing NodeJS package dependencies, but it has since evolved\ninto a tool for front-end JavaScript.\n\nIf you already know something about usage of npm and npm packages, then you can\ndirectly see npm package manager section.\n\n\nnpm package type project#\n\nSo what is an npm package type project? When we execute the npm init command in\nan empty project directory, it creates a JSON file with the file name\npackage.json under the current directory. During the creation process, we will\nneed to fill in information including but not limited to the name, version\nnumber, description, etc. of the npm package, which will be found in the\nresulting package.json file as follows\n\n\n\nAt this point the project containing the initialized package.json file is an npm\npackage type project, and you can execute the npm publish command to publish the\nproject to the npm Registry.\n\nThe npm Registry is a npm package store where developers can not only publish\ntheir own npm packages to the npm Registry, but also use npm packages published\nby other developers through the npm Registry.\n\nA quality npm package will be used by more people because it not only saves a\nlot of code implementation work, but is also less likely to cause problems with\nthe project.\n\n\nUsing third-party npm packages#\n\nWhen adding a third-party npm package to an initial project, we can call this\nprocess \"installing dependencies for the project\" or \"adding dependencies to the\nproject\". Before adding dependencies, we need to know one thing in particular --\nthe types of packages npm depends on.\n\n * \"dependencies\": a type of package that your application will need in a\n production environment.\n * \"devDependencies\": another type of package that is only needed for local\n development and testing.\n \n > packages can be understood as third-party npm packages.\n\nYou can install the packages you need in a production environment by running npm\ninstall npm-package-name or npm add npm-package-name, or you can manually write\nthe packages you need to install and the corresponding semantic version in\n\"dependencies\" in the package.json file, and run the npm install command to.\n\n\n\nSimilarly, you can install only packages needed for local development and\ntesting by running npm install npm-package-name --save-dev or npm add\nnpm-package-name --save-dev, or you can manually write the packages to be\ninstalled and the corresponding semantic version in \"devDependencies\" in the\npackage.json file, and run the npm install command as follows\n\n\n\nWhen installing or using third-party npm packages be sure to determine what they\nare for and whether they should be placed in \"dependencies\" or \"devDependencies\"\nby distinguishing between their types.\n\nTIP\n\nIn general, packages that need to be used in source code are dependencies\ndependencies. Unless you are exporting dependent code locally via packaging, in\nwhich case it can be treated as a devDependencies dependency.\n\n\nOther npm bits and pieces to know#\n\n\nProgram entry for npm packages#\n\nThere is a \"main\" attribute in package.json that corresponds to a module ID or,\nmore intuitively, a NodeJS file path, which is the main entry point for your\napplication.\n\nFor example, if your package is named foo and the user installs it, and then\nexecutes the require(\"foo\") code, then the file corresponding to the \"main\"\nfield of the npm package foo will be exported.\n\nIt is recommended to set the \"main\" field in your npm package. If \"main\" is not\nset, the default entry will be the index.js file in the root of the package.\n\nIn addition to the \"main\" attribute, the \"module\" attribute is usually set. It\nis similar to the \"main\" attribute in that it is mainly used in webpack\nscenarios. webpack reads the npm package entry (file) in most cases in the order\n\"module\" -> \"main \".\n\n> To learn more about how webpack does this, check out this link.\n\n\nscripts#\n\nThe \"scripts\" attribute of the package.json file supports a number of built-in\nscripts and npm-preset lifecycle events, as well as arbitrary scripts.\n\nThese can be executed by running npm run-script or simply npm run .\n\nName matching pre and post commands will also be run (e.g. premyscript,\nmyscript, postmyscript ).\n\n\n\nWhen npm run myscripts is executed, the script corresponding to premyscripts\nwill be executed before it, and the script corresponding to postmyscripts will\nbe executed after it.\n\nScript commands from dependencies can be run with npm explore -- npm run .\n\nThere are also special lifecycle scripts that occur only under certain\ncircumstances. Here are a few that are usually necessary to know.\n\nnpm install#\n\nWhen you run npm install -g , the following scripts will run.\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\nIf your package root has a binding.gyp file and you don't define an install or\npreinstall script, then npm will build with node-gyp rebuild as the default\ninstall command, using node-gyp.\n\nnpm publish#\n\nWhen publishing a project, executing this command will trigger the following\nscript.\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\nWhen running in -dry-run mode, the script corresponding to prepare will not be\nexecuted.\n\n\npeerDependencies#\n\nIn some cases, your npm project has a compatibility relationship with its host\ntool or library (e.g. a webpack plugin project and webpack), and your npm\nproject does not want to use the host as a necessary dependency, which usually\nmeans that your project is probably a plugin for that host tool or library. Your\nnpm project will have certain requirements for the version of the host package,\nas only the APIs required by the npm project will be exposed under a specific\nversion.\n\nFor more explanation of peerDependencies, you can learn about the different ways\nnpm, pnpm, and Yarn handle it at the following links.\n\n * npm's explanation of peerDependencies\n * pnpm vs npm vs Yarn\n\n\nnpm package manager#\n\nIn addition to the standard package manager like npm, the mainstream ones are\npnpm and Yarn, both of which are good alternatives to npm cli.\n\nIt is recommended to use pnpm to manage project dependencies, which can be\ninstalled as follows.\n\n\n\n\nModern.js Module configuration file#\n\nThe Modern.js Module configuration file - modern.config.(j|t)s - is provided in\nthe project directory of the module project created with @modern-js/create.\nHowever, the modern.config configuration file is not required to exist.\n\nBy default, the contents of the generated configuration file are as follows.\n\n\n\nWe recommend using the defineConfig function, but it is not mandatory to use it.\nSo you can also return an object directly in the config file: the\n\n","routePath":"/module-tools/en/guide/basic/before-getting-started","lang":"en","toc":[{"text":"Environment preparation","id":"environment-preparation","depth":2,"charIndex":3},{"text":"Getting Started with npm","id":"getting-started-with-npm","depth":2,"charIndex":424},{"text":"npm package type project","id":"npm-package-type-project","depth":2,"charIndex":906},{"text":"Using third-party npm packages","id":"using-third-party-npm-packages","depth":2,"charIndex":1922},{"text":"Other npm bits and pieces to know","id":"other-npm-bits-and-pieces-to-know","depth":2,"charIndex":3606},{"text":"Program entry for npm packages","id":"program-entry-for-npm-packages","depth":3,"charIndex":3643},{"text":"`scripts`","id":"scripts","depth":3,"charIndex":-1},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":5883},{"text":"npm package manager","id":"npm-package-manager","depth":2,"charIndex":6585},{"text":"Modern.js Module configuration file","id":"modernjs-module-configuration-file","depth":2,"charIndex":6850}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":20,"title":"CLI Commands","content":"#\n\nCLI Commands available for Modern.js Module projects are as follows:\n\n\nmodern build#\n\n\n\nModern.js Module supports the platform build mode, which can be used to execute\nbuild tasks of other tools. Currently, the official support includes Rspress.\nFor example, you can start the doc build task to generate doc products by\nexecuting the modern build --platform commands.\n\n\nmodern new#\n\n\n\nThe modern new command is used to start the microgenerator functionality, which\nenables features for the project that are not provided by default.\n\nThe following features can currently be enabled.\n\n * Storybook V7\n * Tailwind CSS support\n * Modern.js Runtime API\n\nYou can learn more about these features in the Using the micro generator\nsection.\n\n\nmodern dev#\n\n\n\nThe Modern.js Module provides the ability to use debugging tools, which can be\nstarted with the modern dev command. Note, however, that no debugging-related\nplugins are provided by default, so executing modern dev will prompt: \"No dev\ntools found available \".\n\nThe officially supported debugging tool is Rspress, so you can run modern dev or\nmodern dev doc to execute it after you run modern new to enable it.\n\n\nmodern lint#\n\n\n\nRun ESLint to check the syntax of the code. Usually, we only need to check the\npart of the code that was changed in this commit with lint-staged during the\n-git commit phase.\n\n * The -no-fix argument turns off the ability to automatically fix lint error\n code.\n\n\nmodern change#\n\n\n\nThe modern change command is used to generate the required Markdown file for\nchangesets.\n\n\nmodern pre#\n\n\n\nYou can use the modern pre command to pre-release a version before the official\nrelease.\n\n\nmodern bump#\n\n\n\nModify the version number in package.json according to the Markdown file of the\nchangelog generated by changesets, and generate the CHANGELOG.md file.\n\n\nmodern release#\n\n\n\nThe -modern release command releases the module to the npm Registry.\n\n * The -tag argument specifies the specific dist tags to be used for the\n release.\n\n\nmodern gen-release-note#\n\n\n\nAutomatically generate Release Note based on the changeset information of the\ncurrent repository.\n\nTIP\n\nneeds to be executed before the bump command.\n\n\nmodern upgrade#\n\n\n\nThe modern upgrade command is used to upgrade the project Modern.js related\ndependencies to the latest version.\n\nExecuting the command npx modern upgrade in the project root directory will\nupdate the Modern.js dependencies in package.json of the currently executing\nproject to the latest version by default.","routePath":"/module-tools/en/guide/basic/command-preview","lang":"en","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":21,"title":"Modify the output","content":"#\n\n\nDefault output artifacts#\n\nWhen you use the modern build command in an initialized project, Modern.js\nModule will generate corresponding build artifacts based on the current\nconfiguration.\n\nThe default configuration is as follows:\n\n\n\nThe default output files has the following characteristics.\n\n * will generate CommonJS and ESM.\n * The code syntax is supported up to ES6 , and more advanced syntax will be\n converted.\n * All code is bundled into one file, i.e. bundle processing is performed.\n * The output root directory is the dist directory under the project, and the\n type file output directory is dist/types.\n\nYou may have the following questions when you see this.\n\n 1. what is buildPreset?\n 2. what determines these characteristics of the product?\n\nThen the next step is to first explain buildPreset.\n\n\nbuildPreset#\n\nThe buildPreset represents a prepared set or sets of build-related\nconfigurations that can be used to eliminate the trouble and complexity of\nconfiguration by using the default values corresponding to the build Preset,\nresulting in the expected product.\n\nModern.js Module mainly comes with two built-in build presets, including:\n\n * npm-component: Used to build component libraries.\n * npm-library: Used to package projects of other library types, such as tool\n libraries.\n\nIt also provides some variations, such as npm-library-with-umd and\nnpm-library-es5, which, as their names suggest, correspond to library presets\nwith umd output and support for es5 syntax, respectively. For more detailed\nconfiguration, you can refer to its API.\n\nIn addition, we can also fully customize the build configuration:\n\n\nbuildConfig#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. What was mentioned at the beginning about \"features of build\nartifacts\" are actually properties supported by buildConfig. The currently\nsupported properties cover the needs of most module type projects when building\nartifacts. buildConfig not only contains some properties that artifacts have,\nbut also contains some features needed to build artifacts. The following is a\nbrief list from a classification point of view.\n\nThe basic attributes of a build artifacts include:\n\n * Whether the artifact is bundled or not: the corresponding API is\n buildConfig.buildType.\n * Product support for syntax: the corresponding API is buildConfig.target.\n * Output format: the corresponding API is buildConfig.format.\n * How the output type file is handled: the corresponding API is\n buildConfig.dts.\n * How the sourceMap of the artifact is handled: the corresponding API is\n buildConfig.sourceMap.\n * The input (or source file) corresponding to the output: the corresponding API\n is buildConfig.input.\n * The directory of the output of the artifact: the corresponding API is\n buildConfig.outDir.\n * Build source directory: the corresponding API is buildConfig.sourceDir.\n\nCommon functions required for build artifacts include:\n\n * Alias: The corresponding API is buildConfig.alias.\n * Static resource handling: the corresponding API is buildConfig.asset.\n * Third-party dependency handling: The corresponding APIs are\n * buildConfig.autoExternal.\n * buildConfig.externals.\n * Copy: The corresponding API is buildConfig.copy.\n * Global variable substitution: the corresponding API is buildConfig.define.\n * Specify JSX compilation method, the corresponding API is\n [buildConfig.jsx](/api/config/ build-config#jsx).\n\nSome advanced properties or less frequently used functions:\n\n * Product code compression: The corresponding API is buildConfig.minify.\n * Code splitting: buildConfig.splitting\n * Specify whether the build artifacts is for the NodeJS environment or the\n browser environment: the corresponding API is buildConfig.platform.\n * umd product-related.\n * Specifies the global variables imported externally to the umd product: the\n corresponding API is buildConfig.umdGlobals.\n * Specify the module name of the umd product: the corresponding API is\n buildConfig.umdModuleName.\n\nIn addition to the above categories, frequently asked questions and best\npractices about these APIs can be found at the following links\n\n * About bundle and bundleless?\n * About input and sourceDir\n * About d.ts.\n * How to use define\n * How to handle third-party dependencies?\n * How to use copy?\n * How to use umd\n * How to use asset\n\n\nCombining Configuration and Presets#\n\nOnce we understand buildPreset and buildConfig, we can use them together.\n\nIn a real project, we can use buildPreset to quickly get a set of default build\nconfigurations. If you need to customise it, you can use buildConfig to override\nand extend it.\n\nThe extension logic is as follows.\n\n * When buildConfig is an array, new configuration items are added to the\n original preset.\n\n\n\nThis will generate an additional IIFE-formatted product that supports up to\nES2020 syntax on top of the original preset, in the dist/global directory under\nthe project.\n\n * When buildConfig is an object, the configuration items in the object are\n overwritten in the preset.\n\n\n\nThis will cause a sourceMap file to be generated for each build task.","routePath":"/module-tools/en/guide/basic/modify-output-product","lang":"en","toc":[{"text":"Default output artifacts","id":"default-output-artifacts","depth":2,"charIndex":3},{"text":"buildPreset","id":"buildpreset","depth":2,"charIndex":818},{"text":"buildConfig","id":"buildconfig","depth":2,"charIndex":1639},{"text":"Combining Configuration and Presets","id":"combining-configuration-and-presets","depth":2,"charIndex":4390}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":22,"title":"Versioning and Publishing","content":"#\n\nAn npm-type module project release process consists of two phases.\n\n * The first phase is during development, where the developer needs to provide a\n change file to record changes that need to be released.\n * The second phase is during release, collect all the change files to update\n the version, update the release log, and release new packages to the npm\n Registry.\n\nModern.js Module provides a set of version management and release solutions,\nwhich are suitable for single-package scenarios. For npm packages in monorepo,\nyou need to follow the strategies provided by various monorepo solutions.\n\n\nTracking changes#\n\nChanges need to be logged when they happen to the project. Changes that occur in\na project are typically.\n\n * New features\n * Fixes to issues\n * Configuration file changes\n * ...\n\nOnce these changes have been made, the current changes need to be documented\nwith the following command.\n\n * modern change\n\nExecuting the modern change command asks the developer several questions and\ngenerates a change log based on the developer's answers. The changelog file\ncontains the type of change and its description, and is committed to the git\nrepository.\n\n\n\nWhen executed successfully, the resulting Markdown file containing the change\nlog is saved in the project's .changeset directory. The contents will look like\nthe following.\n\n\n\n\nVersion update#\n\nWhen the project version needs to be updated, execute the following command.\n\n * modern bump\n\nExecuting modern bump will modify the version number in package.json based on\nthe contents of the Markdown file in the .changeset/ directory where the changes\nwere recorded, and generate the CHANGELOG.md file. These Markdown files are also\ndeleted when the version update is complete, so they are \"consumed \".\n\n\n\n\nPublish#\n\nTo publish a project, you can execute the following command.\n\n * modern publish\n\nThe modern release command publishes the project to the npm Registry.\n\nThe release is the latest version, which is also the official version. If you\nwant to change the dist-tag, you can specify it with the modern release --tag\ncommand. For example.\n\n\n\nHowever, if you want to change the version number of the current project to a\npre-release as well, you need to use the modern pre command.\n\n> dist-tag can be understood as: tagging the current release. Generally\n> speaking, the dist-tag for the default release is latest, so you can consider\n> latest as the dist-tag for the official release.\n\n\nPre-releases#\n\nWhen a pre-release is needed before the official release, the following command\nis executed.\n\n * modern pre\n\nFirst modern pre enter to enter pre-release mode, can be the same as the tag\nspecified with the modern release --tag command when releasing the project.\n\n\n\nThen you can update the specific version number with the modern bump command,\nwhich doesn't actually \"consume\" the Markdown file that records the changes:\n\n\n\nThen you can see that the updated version number in package.json will look like\nthis: 0.1.2-next.0.\n\nFinally, if you don't need to do a pre-release anymore, be sure to run the\nmodern pre exit command to exit the pre-release state and to release the\nofficial version when you run the modern bump command again.","routePath":"/module-tools/en/guide/basic/publish-your-project","lang":"en","toc":[{"text":"Tracking changes","id":"tracking-changes","depth":2,"charIndex":610},{"text":"Version update","id":"version-update","depth":2,"charIndex":1355},{"text":"Publish","id":"publish","depth":2,"charIndex":1780},{"text":"Pre-releases","id":"pre-releases","depth":2,"charIndex":2468}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":23,"title":"Using the Microgenerator","content":"#\n\nModern.js Module provides the Microgenerator tool, which allows for the current\nproject to.\n\n * add new directories and files\n * Modify the contents of the package.json file\n * Execute commands\n\nThus with these capabilities, Microgenerator can enable additional feature\nfunctionality for the project.\n\nThe microgenerator can be started via modern new. The current Microgenerator\nfeatures supported by the Modern.js Module are:\n\n\nDevelop Module Doc#\n\nWhen we want to write documentation for out module project, we can enable the\nmodule doc feature. will create docs directory and related files in the project\ndirectory, and add \"@modern-js/plugin-rspress\" dependency in package.json. Use\nmodern dev and modern build --platform to debug and build your doc site.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n\n\n\nStorybook#\n\nThe Storybook feature can be enabled when we want to debug a component or a\ncommon module. When this feature is enabled, the stories directory and\n.storybook directory are created in the project directory, and a new\n\"@modern-js/storybook\" dependency is added to package.json. Use storybook dev\nand storybook build to debug and build.\n\n\nTailwind CSS Support#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nIf you want to use Tailwind CSS for a project, you can refer to \"Using Tailwind\nCSS\".\n\n\nModern.js Runtime API#\n\nModern.js provides Runtime API capabilities that can only be used in the\nModern.js application project environment. If you need to develop a component\nfor use in a Modern.js application environment, then you can turn on this\nfeature and the microgenerator will add the \"@modern-js/runtime\" dependency.\n\nAlso, the Storybook debugging tool will determine if the project needs to use\nthe Runtime API by checking the project's dependencies and providing the same\nRuntime API runtime environment as the Modern.js application project.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-micro-generator","lang":"en","toc":[{"text":"Develop Module Doc","id":"develop-module-doc","depth":2,"charIndex":431},{"text":"Storybook","id":"storybook","depth":2,"charIndex":895},{"text":"Tailwind CSS Support","id":"tailwind-css-support","depth":2,"charIndex":1243},{"text":"Modern.js Runtime API","id":"modernjs-runtime-api","depth":2,"charIndex":1528}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":24,"title":"Developing Module documentation","content":"#\n\nThis chapter describes how to quickly build a static documentation site for a\nmodule project.\n\n\nBefore we start#\n\n\nWhy we need to build a documentation site for a module#\n\n 1. a documentation site can help us to better organize the structure of the\n documentation.\n 2. the documentation site has better presentation, such as the ability to\n execute functions in the page, render components.\n 3. to make better use of AI search capabilities.\n\n\nPreliminary preparation#\n\n 1. Enable the documentation feature via micro-generator.\n 2. Read Introduction to Rspress.\n\nAfter finishing the preparation work, we will build a documentation site for the\nmodule project based on Rspress.\n\n\nBasic site structure#\n\nThe overall layout of the site consists of three parts: the navigation bar, the\nsidebar and the body part, which also includes the TOC (Table of contents found\nat the beginning of a book or document).\n\nThe Rspress uses File System Routing, on which the module documentation is\nbased, to automate the generation of the sidebar. For example, if you have the\nfollowing file structure:\n\n\n\nThen the routing path for foo/bar.md will be /foo/bar, the routing path for\nfoo.md will be /foo, and the routing path for index.md will be /.\n\nThe specific mapping rules are as follows:\n\nFILE-PATH ROUTING-PATH\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\nThe sidebars corresponding in turn to the above file paths and routing paths are\nshown below:\n\n\nConfigure sidebar#\n\nAs shown in the figure above, the module documentation has automatically\ngenerated sidebars for file system routing, where the text of each column of the\nsidebar is determined by the file's first level title or directory name. If you\nneed to customize the sidebar, please use _meta.json or configure sidebar\ndirectly.\n\nINFO\n\nIf your document directory structure complies with internationalization, for\nexample:\n\n\n\nYou need to follow internationalization guide and configure lang 和 locales,\notherwise, the automatically generated sidebar of the module will not handle the\nzh and en directories.\n\n\nWriting Documentation#\n\nNext, we can focus on writing the content of the document. In addition to the\nbasic Markdown syntax, you may also need to understand the following advanced\ntopics:\n\n * Using MDX\n * Using Assets\n\n\nComponent preview#\n\nModule documentation provides preview capabilities for component libraries. The\ncontents in code blocks written in jsx and tsx will be parsed as React\ncomponents.\n\n\nExample#\n\nHere is a complete example using the component preview feature:\n\nAssuming our project name is demo and we export a Button component.\n\n 1. Add a new docs/Button.mdx file:\n\n\n\n 2. In the tsconfig.json, configure aliases and point the package name to the\n current project directory, make the way document developers and users use\n components consistent:\n\n\n\n 3. In the .gitignore, add doc_build/:\n\n\n\nCongratulations, you have finished writing a component document, execute pnpm\nrun dev to see the result, remember to build the component library first to make\nsure the component product exists.\n\n\nMobile Preview#\n\nAlso, we support mobile preview mode, i.e. rendering mobile components using\niframe, and set iframe position by iframePosition, support swipe preview and new\npage opening.\n\n\n\nTIP\n\nIf you only want to change the way a particular jsx and tsx block is previewed,\nyou can use a different modifier to identify it:\n\n\n\n\nUsing external demos#\n\nIf our demo is very complex, then it is recommended to write the demo separately\nand then use the code tag in the mdx:\n\n\n\nThis also supports setting the preview method for each individual code block,\nfor example:\n\n\n\n\nUsing built-in components#\n\nThe plugin implements some built-in components internally so that you can\ndevelop module documentation more easily.\n\n\nAPI#\n\nDisplay the API content of the module.\n\nParse file#\n\nBefore we can use the API component, we first need to specify the files to\nparse:\n\n\n\nContent generation#\n\nNext, we'll see what kind of markdown content is generated based on the parsed\nfile.\n\nContent can be generated with two different tools, react-docgen-typescript or\ndocumentation:\n\n * react-docgen-typescript is targeted at component library scenarios and will\n only parse props to generate tables.\n\n\n\nThe above is a standard writeup where ButtonProps will be extracted into the\ntable and Button will be the title of the table. If you use the default export,\nthe filename will be used as the form title.\n\nNotice that export features declared elsewhere are not available.\n\n\n\nThe generated content is as follows:\n\n\n\nWARNING\n\nIf React types are used in Props, you need to add the types in tsconfig.json,\notherwise the types will not be resolved under the React namespace.\n\n\n\nThe best way is that you import the type directly:\n\n\n\n * documentation is used in tool library scenarios to parse JSDoc annotations.\n\n\n\nThe above is a greet function with a JSDoc annotation. The generated content is\nas follows:\n\n\n\nUsing the component#\n\nNext, you can use our built-in API components in your documentation by passing\nthe key value into the moduleName property。\n\n\n\n\nOverview#\n\nDisplays a list of modules that can be placed on the front page to display all\nmodules.\n\nThe Overview component has only one list property, which receives an array of\nobjects, and the following properties of the objects\n\nPROPERTY DESCRIPTION TYPE DEFAULT\nicon icon React.ReactNode \ntext text(required) string \nlink link(required) string \narrow whether to show arrows boolean false\n\n\nPlugin options#\n\n\napiParseTool#\n\nAPI parse tool.\n\n * Type:'react-docgen-typescript' | 'documentation'\n * Default: 'react-docgen-typescript'\n\n\ndoc#\n\nConfig.\n\n\nentries#\n\nModule names and relative paths for automatically generated documents.\n\n * Type:Entries | ToolEntries\n * Default: {}\n\n\n\nIt also supports the use of different parsing tools for different files:\n\n\n\n\niframePosition#\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nWhen the value is follow, each code block will have an iframe showing its\nrendered view. When fixed, the iframe will be fixed to the right side of the\npage, showing the view of all the code blocks on the current page.\n\n\nparseToolOptions#\n\nAPI parse tool options.\n\n * Type:ParseToolOptions\n * Default: {}\n\n\n\n\npreviewMode#\n\n * Type:'iframe' | 'internal'\n * Default: 'internal'\n\nIn case of internal, the component will be rendered directly in the page,\notherwise it will be loaded through an iframe.\n\n\ndeprecated: languages#\n\nWARNING\n\nStarting from version 2.44.0, please refer to the Internationalization section\nto implement multiple languages.\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\nStarting from version 2.44.0, a sniffing mechanism has been implemented\ninternally, so please directly use _meta.json or directly configure sidebar to\nimplement a custom sidebar.\n\n\nScripts#\n\n * modern dev: Start dev server for doc site.\n * modern build --platform: Build doc site in production, by default output\n directories is doc_build.\n\n\nAdvanced guide#\n\nThe above has covered the basics of developing module documentation, but this is\nnot enough for developing a complete documentation station. Check out the\nRspress for an in-depth look at our documentation framework. You can modify the\ndocumentation framework configuration via the doc configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-module-doc","lang":"en","toc":[{"text":"Before we start","id":"before-we-start","depth":2,"charIndex":98},{"text":"Why we need to build a documentation site for a module","id":"why-we-need-to-build-a-documentation-site-for-a-module","depth":3,"charIndex":117},{"text":"Preliminary preparation","id":"preliminary-preparation","depth":3,"charIndex":451},{"text":"Basic site structure","id":"basic-site-structure","depth":2,"charIndex":686},{"text":"Configure sidebar","id":"configure-sidebar","depth":3,"charIndex":1493},{"text":"Writing Documentation","id":"writing-documentation","depth":2,"charIndex":2109},{"text":"Component preview","id":"component-preview","depth":2,"charIndex":2329},{"text":"Example","id":"example","depth":3,"charIndex":2514},{"text":"Mobile Preview","id":"mobile-preview","depth":3,"charIndex":3121},{"text":"Using external demos","id":"using-external-demos","depth":3,"charIndex":3451},{"text":"Using built-in components","id":"using-built-in-components","depth":2,"charIndex":3691},{"text":"API","id":"api","depth":3,"charIndex":3837},{"text":"Parse file","id":"parse-file","depth":4,"charIndex":3883},{"text":"Content generation","id":"content-generation","depth":4,"charIndex":3981},{"text":"Using the component","id":"using-the-component","depth":4,"charIndex":5005},{"text":"Overview","id":"overview","depth":3,"charIndex":5154},{"text":"Plugin options","id":"plugin-options","depth":2,"charIndex":5675},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":5693},{"text":"doc","id":"doc","depth":3,"charIndex":5817},{"text":"entries","id":"entries","depth":3,"charIndex":5833},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":6040},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":6320},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":6408},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":6599},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":6746},{"text":"Scripts","id":"scripts","depth":2,"charIndex":6967},{"text":"Advanced guide","id":"advanced-guide","depth":2,"charIndex":7130}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":25,"title":"Using Storybook","content":"#\n\nStorybook is a tool dedicated to component debugging, providing around component\ndevelopment.\n\n * Develop UIs that are more durable\n * Test UIs with less effort and no flakes\n * Document UI for your team to reuse\n * Share how the UI actually works\n * Automate UI workflows\n\nBefore when using Storybook, there are various problems related to\nconfigurations, Babel, Webpack, less or sass. Modern.js integrates with\nStorybook, which greatly simplifies configuration for us as we develop our\nStorybook project.\n\n\nV7 (Recommended)#\n\n\nEnable Storybook#\n\nYou can directly enable the Storybook feature by using the following command:\n\n\n\nThis command will create a template for Storybook, including:\n\n * Creating a configuration folder .storybook and a default configuration file\n .storybook/main.ts.\n * Creating example story components.\n * Updating package.json to add dependencies @storybook/addon-essentials and\n @modern-js/storybook, as well as creating Storybook-related scripts.\n\n\nEnable Debug output#\n\nIn fact, Modern.js Module is implemented based on esbuild, while Storybook uses\nWebpack as the default build tool, and their configurations are not fully\ncompatible. Therefore, we recommend building the components first, and then\nimporting the component output in stories.\n\nThe way to import component outputs is very simple. Suppose your module exports\na Button component, then you can use it in stories like this:\n\n\n\nIf you want to update the components, you can start the build in watch mode\nbefore starting Storybook:\n\n\n\nINFO\n\nIn the development process, you may encounter situations where you cannot get\ntype definitions in real time. Because only when the code is saved, the type\nfile under the output directory will be updated. At this time:\n\nFor pnpm projects, you can modify the package.json as follows:\n\n\n\n> For the use of publishConfig in pnpm, you can read the following link.\n\nFor npm and Yarn projects, the types value of package.json can only be modified\nmanually during the development stage and release stage.\n\n\nEnable Rspack build#\n\nRspack is known for its fast build speed. To use Rspack as a build tool in\nModern.js, you only need to configure it as follows:\n\n\n\nNote that in the above configuration, the reactDocgen configuration has been\nchanged because Rspack currently does not support\n@storybook/react-docgen-typescript-plugin.\n\n\nConfigurations#\n\nThere are some separate configurations in .storybook/main.js.\n\nbundler#\n\n * Type: 'webpack' | 'rspack'\n * Default: webpack\n\nSpecify the underlying bundler to use either Webpack or Rspack.\n\nExample:\n\n\n\nbuilderConfig#\n\n * Type: BuilderConfig\n * Default: undefined\n\nThe Storybook build capability of Modern.js is provided by Rsbuild, and the\nRsbuild configuration can be modified through builderConfig.\n\n\n\n\nCommand#\n\n@modern-js/storybook proxies some storybook cli commands\n\nstorybook dev#\n\nStart Storybook,detail\n\nstorybook build#\n\nBuild Storybook for production,detail\n\n\nMigrate from V6 to V7#\n\nOur support methods for the two versions are different, so if you are migrating\nfrom V6 to V7, we hope you will also use V7 in the same way, while making the\nfollowing adjustments:\n\n * Configuration file: Migrate any custom configurations (if any) in the\n original root/config/storybook/main.(j|t)s to the new\n root/.storybook/main.(j|t)s.\n * Dependencies: Upgrade @storybook/addon-* series dependencies (if any) to\n version 7 and delete @modern-js/plugin-storybook dependencies.\n * Commands: Delete the original edenx dev storybook and edenx build --platform\n commands. If you are used to the original pnpm run dev usage, you can replace\n it with storybook dev -p 6006 and storybook build.\n * modern.config.(j|t)s : Remove the registration of @modern-js/plugin-storybook\n plugin.\n\n\nV6 (legacy)#\n\nStarting from 2.40.0 version, @modern-js/plugin-storybook will stop iterating.\nIt is recommended to use the V7 version. If your @modern-js/module-tools version\nis lower than 2.40.0, you can use Storybook V6 in the following ways:\n\n\nStart Storybook#\n\nYou can directly use the following command to enable the Storybook feature.\n\n\n\nThis command will create commonly used templates for Storybook, including\n\n * Create stories component examples\n * Update package.json, add a dependency on @modern-js/plugin-storybook, and add\n related scripts such as pnpm dev storybook.\n\n\nConfigure Storybook#\n\nThe Storybook official configures the project through a folder named .storybook,\nwhich contains various configuration files. In Modern.js Module, you can add\nStorybook configuration files in the project's config/storybook directory.\n\nFor how to use various Storybook configuration files, you can check the\nfollowing link:\n\n * Configure Storybook\n\nHowever, there are some restrictions when using it in module projects:\n\n * Cannot change the location where Story files are stored, that is, the stories\n configuration cannot be modified in the main.js file.\n * Cannot modify the configuration related to Webpack and Babel, that is, the\n webpackFinal and babel configurations cannot be modified in the main.js file.\n\n\nBuild Storybook Output#\n\nIn addition to debugging the component or ordinary modules with Storybook, you\ncan also use the following command to execute the Storybook build task.\n\n\n\nAfter the build is complete, you can see the build output files in the\ndist/storybook-static directory.","routePath":"/module-tools/en/guide/basic/using-storybook","lang":"en","toc":[{"text":"V7 (Recommended)","id":"v7-recommended","depth":2,"charIndex":511},{"text":"Enable Storybook","id":"enable-storybook","depth":3,"charIndex":531},{"text":"Enable Debug output","id":"enable-debug-output","depth":3,"charIndex":985},{"text":"Enable Rspack build","id":"enable-rspack-build","depth":3,"charIndex":2036},{"text":"Configurations","id":"configurations","depth":3,"charIndex":2361},{"text":"bundler","id":"bundler","depth":4,"charIndex":2441},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":2579},{"text":"Command","id":"command","depth":3,"charIndex":2782},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":2850},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":2890},{"text":"Migrate from V6 to V7","id":"migrate-from-v6-to-v7","depth":2,"charIndex":2948},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":3767},{"text":"Start Storybook","id":"start-storybook","depth":3,"charIndex":4013},{"text":"Configure Storybook","id":"configure-storybook","depth":3,"charIndex":4352},{"text":"Build Storybook Output","id":"build-storybook-output","depth":3,"charIndex":5092}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":26,"title":"Developing Components","content":"#\n\nThis chapter will describe how to develop component projects using the Modern.js\nModule.\n\n\nInitialize the project#\n\n 1. It is recommended to use the @modern-js/create command to initialize an npm\n project.\n\n\n\n 2. The initialized directory structure:\n\n\n\n 3. Finally, modify the file suffix and content of ./src/index.ts as follows,\n and the initialization of the component project is completed.\n\n\n\n\nDebugging code with Storybook#\n\nPlease refer to \"Using Storybook\" to debug code using Storybook.\n\n\nDeveloping Styles#\n\nNext we can add styles to the component.\n\nThe following capabilities are currently supported for developing styles.\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module supports PostCSS and has the following built-in PostCSS\nplugins.\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\nSo we can create .css files in our projects and use the syntax support and\ncapabilities provided by these plugins directly in our css files.\n\n * Source Code:\n\n\n\n * CSS artifact:\n\n\n\n\nLess#\n\nModern.js Module supports development styles using Less.\n\n> The current built-in Less version is v4.1.3\n\n * Source Code:\n\n\n\n * Less artifact:\n\n\n\n\nSass/Scss#\n\nModern.js Module supports developing styles using Scss/Sass.\n\n> The current built-in Sass version is v1.54.4\n\n * Source code:\n\n\n\n * Less artifact:\n\n\n\n\nTailwind CSS#\n\nPlease refer to \"Using Tailwind CSS\" for detailed usage.\n\n\nCSS Modules#\n\nModern.js Module supports the development of styles using CSS Modules. By\ndefault, the following files are recognized as CSS Module files.\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\nIf you need to configure CSS Modules, you can check out the API at\n\n * style.autoModules\n * style.modules\n\nThe following is a code example.\n\n\n\n\n\n\nConfiguring build artifacts#\n\nBased on most scenarios of component project usage, it is recommended to use the\nnpm-component build preset. This preset yields a output directory structure of\n\n\n\n * . /dist/es: Contains bundleless artifacts in ES modules format that support\n the es6 syntax.\n * . /dist/lib: Contains bundleless artifacts in CommonJS format with support\n for es6 syntax.\n * . /dist/types: Contains the types file.\n\nThe buildPreset can be configured manually if there is a requirement to use\nsyntax support, and supports modifying the supported syntax by adding a suffix\nto npm-component.\n\n\n\nIf you have special needs for the build artifacts directory structure, you can\nuse the buildConfig API, which can be used by the following documentation.\n\n * modify-output-product\n * in-depth-about-build\n\n\nReleasing components#\n\nIt is recommended to use the version release feature provided by Modern.js\nModule. You can refer to the \"Version Management and Release\" section for more\ninformation.","routePath":"/module-tools/en/guide/best-practices/components","lang":"en","toc":[{"text":"Initialize the project","id":"initialize-the-project","depth":2,"charIndex":93},{"text":"Debugging code with Storybook","id":"debugging-code-with-storybook","depth":2,"charIndex":406},{"text":"Developing Styles","id":"developing-styles","depth":2,"charIndex":505},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":711},{"text":"Less","id":"less","depth":3,"charIndex":1098},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":1251},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":1414},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":1488},{"text":"Configuring build artifacts","id":"configuring-build-artifacts","depth":2,"charIndex":1852},{"text":"Releasing components","id":"releasing-components","depth":2,"charIndex":2666}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":27,"title":"Using Tailwind CSS","content":"#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nModern.js Module supports developing component styles using Tailwind CSS.\n\n\nEnabling Tailwind CSS#\n\nTo use Tailwind CSS in Modern.js Module, you can follow the steps below:\n\n 1. Run pnpm run new in the root directory of your project and make the\n following selections:\n\n\n\nAfter successful initialization, you will see that the package.json has added\ndependencies for tailwindcss and @modern-js/plugin-tailwindcss.\n\n 2. Register the Tailwind plugin in modern.config.ts:\n\n\n\n 3. Create a index.css file and add the following code:\n\n\n\nINFO\n\nDepending on your needs, you can selectively import the CSS styles provided by\nTailwind CSS. Please refer to the @tailwind documentation for detailed usage of\nthe @tailwind directive.\n\n 4. Import the index.css file, for example, add the following code in the root\n component src/index.jsx:\n\n\n\n 5. Now you can use the Utility Classes provided by Tailwind CSS in your\n components:\n\n\n\n\nConfiguring Tailwind CSS#\n\nIn Modern.js Module, you have two ways to configure Tailwind CSS:\n\n 1. Using the tailwind.config.{ts,js} file, which follows the official usage of\n Tailwind CSS. Please refer to \"Tailwind CSS - Configuration\" for more\n details.\n\n\n\nTIP\n\nPlease upgrade Modern.js to version >= 2.33.0 to support automatic reading of\ntailwind.config.{ts,js} files.\n\n 2. Using the style.tailwindcss configuration option. This is the old way of\n configuring Tailwind CSS, and we recommend using the tailwind.config.{ts,js}\n file for configuration.\n\n\n\nIf you are using both the tailwind.config.{ts,js} file and style.tailwindcss\noption, the configuration defined in style.tailwindcss will take precedence and\noverride the content defined in tailwind.config.{ts,js}.\n\n\nTailwind CSS Autocomplete#\n\nTailwind CSS provides an official extension called Tailwind CSS IntelliSense for\nautocompletion of Tailwind CSS class names, CSS functions, and directives in VS\nCode.\n\nYou can follow the steps below to enable the autocomplete feature:\n\n 1. Install the Tailwind CSS IntelliSense extension in VS Code.\n 2. If the root directory of your project does not have a\n tailwind.config.{ts,js} file, you need to create one and write the Tailwind\n CSS configuration for your current project. Otherwise, the IDE plugin will\n not work correctly.\n\n\nBuild Modes#\n\nWhen using Tailwind CSS, please note that there are significant differences\nbetween the bundle and bundleless modes in terms of the build artifacts.\n\nTIP\n\nFor definitions of bundle and bundleless, please refer to the \"In-depth\nunderstanding of build\".\n\n\nBundle Mode#\n\nIn Bundle mode, a separate CSS file is generated, and the JS output does not\nautomatically reference the CSS output file.\n\n * Source code:\n\n\n\n * Output code:\n\n\n\n\n\nIf you need to inject styles into the JS artifact, you can enable the\nstyle.inject option.\n\nIf you haven't enabled style.inject, you can also let users manually import the\nCSS file:\n\n\n\n\nBundleless Mode#\n\nIn bundleless mode, the CSS file is automatically imported in the artifact code\nwithout the need for additional processing.\n\n * Output code:\n\n\n\n\nClass Name Prefix#\n\nYou can add a class name prefix using the prefix option provided by Tailwind\nCSS. This helps avoid potential class name conflicts, such as when different\nversions of Tailwind CSS are used in different parts of an application or\nmodule.\n\nFor example, you can add the foo- prefix using the prefix option in\ntailwind.config.js:\n\n\n\n * Source Code:\n\n\n\n * Output Code:\n\n\n\n\nUsage Guide#\n\nHere are some usage examples of Tailwind CSS.\n\n\nHTML Class Names#\n\nTailwind CSS supports adding styles to HTML tags through class names. When using\nHTML class names, please note that the corresponding CSS styles of Tailwind CSS\nmust be imported in advance.\n\n\n\nGenerated styles (after bundling):\n\n\n\n\n@apply#\n\nTailwind CSS provides the @apply directive, which allows us to inline the styles\nprovided by Tailwind CSS into our own styles.\n\n@apply can be used in CSS, Less, and Sass.\n\n\n\nHowever, there are some considerations when using it with Less and Sass:\n\nSass#\n\nWhen using Tailwind with Sass and there is an !important after @apply,\ninterpolation should be used to ensure Sass compiles correctly.\n\n * Won't work as expected:\n\n\n\n * Will work as expected:\n\n\n\nLess#\n\nWhen using Tailwind with Less, you cannot nest Tailwind's @screen directive.\n\n * Won't work as expected:\n\n\n\n * Instead, use regular media queries and the theme() function to reference your\n screen sizes or simply avoid nesting your @screen directive.\n\n\n\n\n\n\nAbout designSystem config#\n\ndesignSystem is a deprecated configuration option in Modern.js Module.\n\nStarting from Modern.js Module version 2.33.0, you can use the theme\nconfiguration option of Tailwind CSS as a replacement for designSystem. It is no\nlonger necessary to split the theme configuration and set it on designSystem.\n\n * Previous usage:\n\n\n\n * Current usage:\n\n","routePath":"/module-tools/en/guide/best-practices/use-tailwindcss","lang":"en","toc":[{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":2,"charIndex":252},{"text":"Configuring Tailwind CSS","id":"configuring-tailwind-css","depth":2,"charIndex":1105},{"text":"Tailwind CSS Autocomplete","id":"tailwind-css-autocomplete","depth":3,"charIndex":1889},{"text":"Build Modes","id":"build-modes","depth":2,"charIndex":2460},{"text":"Bundle Mode","id":"bundle-mode","depth":3,"charIndex":2728},{"text":"Bundleless Mode","id":"bundleless-mode","depth":3,"charIndex":3091},{"text":"Class Name Prefix","id":"class-name-prefix","depth":2,"charIndex":3254},{"text":"Usage Guide","id":"usage-guide","depth":2,"charIndex":3641},{"text":"HTML Class Names","id":"html-class-names","depth":3,"charIndex":3703},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":4211},{"text":"Less","id":"less","depth":4,"charIndex":4413},{"text":"About `designSystem` config","id":"about-designsystem-config","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":28,"title":"General Questions","content":"#\n\n\nWhat is the relationship between Modern.js Module and Rsbuild?#\n\nModern.js Module uses esbuild to build toolkits and component libraries, and\nRsbuild focuses on solving web application building scenarios.\n\n\nCan Modern.js Module use webpack plugins or loaders?#\n\nModern.js Module is based on esbuild for building and cannot use tools from the\nwebpack-related ecosystem. You can find more community plugins for esbuild here\n\nIf the UMD product produced by Modern.js Module does not meet your requirements,\nyou can use Rsbuild and add UMD Plugin to build UMD products.","routePath":"/module-tools/en/guide/faq/basic","lang":"en","toc":[{"text":"What is the relationship between Modern.js Module and Rsbuild?","id":"what-is-the-relationship-between-modernjs-module-and-rsbuild","depth":2,"charIndex":3},{"text":"Can Modern.js Module use webpack plugins or loaders?","id":"can-modernjs-module-use-webpack-plugins-or-loaders","depth":2,"charIndex":210}],"domain":"","frontmatter":{},"version":""},{"id":29,"title":"Build FAQ","content":"#\n\nHere only some common problems and bad cases are recorded.\n\nIf the build products do not meet expectations, especially when buildPreset is\nconfigured, please first understand what configuration items buildPreset\nrepresents, and then check each configuration item based on all configuration\nitems.\n\n\nProduct FAQ#\n\n\nInitialization of Class Fields#\n\nTypeSript provides the useDefineForClassFields configuration to control the\nconversion handling for public class fields.\n\nIf we have a piece of code:\n\n\n\nWhen useDefineForClassFields is false, then the compiled code will look like:\n\n\n\nWhen useDefineForClassFields is true, then the compiled code will look like:\n\n\n\nAlso the default value of this configuration will change depending on the target\nconfiguration of tsconfig.json: When target is ES2022 or higher, then\nuseDefineForClassFields is configured to true by default, otherwise it defaults\nto false.\n\nFor more information on this configuration of TypeScript, you can refer to the\nfollowing link:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nThe Modern.js Module will currently process according to the following logic:\n\n 1. The first decision to enable this feature inside Modern.js Module is based\n on the useDefineForClassFields configuration in tsconfig.json of the current\n project. Currently, only the contents of the tsconfig.json file under the\n current project path will be read, and the final tsconfig configuration\n based on the extends configuration is not supported at this time.\n 2. If the useDefineForClassFields configuration of tsconfig.json is not\n detected, the default value is determined based on the target configuration\n of tsconfig.json. If target is greater than ES2022 (including EsNext), then\n useDefineForClassFields defaults to true, otherwise it is false.\n 3. If the target of tsconfig.json is not detected, it is processed according to\n the value of useDefineForClassFields as true.\n\n\nbabel-plugin-lodash treats the introduced lodash as undefined#\n\nThis problem occurs when using something like the following:\n\n\n\nCurrent related issues on the babel-plugin-lodash Github:\n\n * #235\n\nThe solution to this problem is to remove babel-plugin-lodash, since the plugin\nis not needed for on-demand referencing at this point and using it would have\nside effects.\n\nA similar situation occurs with babel-plugin-import. If there is code like the\nfollowing:\n\n\n\nIn this case babel-plugin-import may also cause Comps to become undefined. So\nyou need to remove the corresponding babel-plugin-import as well.\n\n\nCannot find module 'http'#\n\nIf the output reports an error like Cannot find module 'http' at browser\nruntime, it means that your output has bundled node modules. This may occur if\nsome of your dependencies support both browser and node, such as axios, in which\ncase you only need to set the platform to browser. If some third-party packages\ndon't support the browser, you may need to manually inject node polyfill.\n\n\nExceptions FAQ#\n\n\nDynamic require of \"react\" is not supported#\n\nProblem Description#\n\nWhen the product format in the product configuration of the build is ES modules.\n\n\n\nIf you import a cjs product from a third-party npm package, the resulting\nproduct may not work properly under webpack.\n\n\n\nSolution#\n\n 1. First you need to find which third-party package is causing the problem. For\n example, if the error message points to the react package, then look for a\n third-party package that has code like require('react') in it. For example\n react-draggable, which only contains cjs artifacts, then the problem is\n localized to the react-draggable package.\n 2. Then we need to exclude this package with the following configuration, i.e.\n not package problematic third-party packages.\n\n\n\nReference Links#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\nDuring compilation, an error was reported in the less file of a component\nlibrary:'Operation on an invalid type'#\n\nThis is probably because the component library depends on Less version v3, while\nModern.js Module defaults to v4. v3 and v4 have a Break Change in the math\nconfiguration, check this link for details.\n\nTherefore, if a component library like this is used in the source code:\n\nbuildPreset is used in the build configuration, make the following changes:\n\n\n\nOr, if a custom buildConfig is used, modify it as follows:\n\n\n\nIf you are using a component like this in Storybook, you will need to modify the\ndebugging configuration of Storybook:\n\n\n\n\nBundleless DTS failed#\n\nIn the bundleless scenario, it's tsc that generates the type declaration file\ndirectly. You can find the problem file by printing the error message in the\nterminal. For source code files, it is recommended to fix the type problem,\nwhich can better enable reuse of your package. However. if you encounter a type\nchecking problem with a thrid-party package:\n\n 1. enable skipLibCheck to skip the d.ts check of the thrid-party package.\n 2. If the package exports ts files directly, skipLibCheck will not work because\n it can only skip the d.ts check, so you can only turn off dts.abortOnError\n to ignore these errors.\n\n\nBundle DTS failed#\n\nThe Modern.js Module directly uses rollup-plugin-dts to package your type\ndescription files. It may not be able to handle the type files of some\nthird-party dependencies\n\nIf you encounter an error message titled \"Bundle DTS failed\" during the build\nprocess of the Modern.js Module, you can observe that the error message is from\na third-party dependency. Try setting dts.respectExternal to false to turn off\nthe behavior of packaging type files of third-party dependencies.\n\n\nError reported for defineConfig function type: If there is no reference to \"...\"\nthen the inferred type of \"default\" cannot be named#\n\nCheck if the include configuration exists in the project's tsconfig.json file,\nand if not, try adding the following:\n\n\n\n\nOther FAQ#\n\n\nHow to skip the pre-processing of less/scss files with bundleless#\n\nBundleless is a single-file compilation method. You just need to remove your\nless/scss files from the entry and copy them to the output. Note that we will\nalso rewrite the moduleId of js referencing less/scss, turn it off through the\nredirect plugin.\n\nBelow is an example of skipping less file processing. You will find that all\nless files in src are copied to dist and the relative path is preserved.\n\n\n\n\nAdd additional compilation feature#\n\nThe Modern.js Module is based on the esbuild implementation, so if you have\nspecial needs or want to add additional compilation capabilities, you can do so\nby implementing the esbuild plugin.\n\nThe Modern.js Module provides esbuildOptions configuration to allow modification\nof Modern.js's internal esbuild configuration, so that custom esbuild plugins\ncan be added via this configuration:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\n\nSupport for generating TypeScript declaration files for CSS Modules#\n\n * First Solution: typed-css-modules\n * Second Solution: postcss-modules-dts\n\n","routePath":"/module-tools/en/guide/faq/build","lang":"en","toc":[{"text":"Product FAQ","id":"product-faq","depth":2,"charIndex":301},{"text":"Initialization of Class Fields","id":"initialization-of-class-fields","depth":3,"charIndex":316},{"text":"babel-plugin-lodash treats the introduced lodash as `undefined`","id":"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":2578},{"text":"Exceptions FAQ","id":"exceptions-faq","depth":2,"charIndex":2995},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":3013},{"text":"Problem Description","id":"problem-description","depth":4,"charIndex":3059},{"text":"Solution","id":"solution","depth":4,"charIndex":3287},{"text":"Reference Links","id":"reference-links","depth":4,"charIndex":3792},{"text":"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`","id":"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":4560},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":5206},{"text":"Error reported for `defineConfig` function type: `If there is no reference to \"...\" then the inferred type of \"default\" cannot be named`","id":"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named","depth":3,"charIndex":-1},{"text":"Other FAQ","id":"other-faq","depth":2,"charIndex":5958},{"text":"How to skip the pre-processing of less/scss files with bundleless","id":"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless","depth":3,"charIndex":5971},{"text":"Add additional compilation feature","id":"add-additional-compilation-feature","depth":3,"charIndex":6445},{"text":"Support for generating TypeScript declaration files for CSS Modules","id":"support-for-generating-typescript-declaration-files-for-css-modules","depth":3,"charIndex":7173}],"domain":"","frontmatter":{},"version":""},{"id":30,"title":"FAQ","content":"#\n\nHere is a list of all frequently asked questions about Modern.js Module.\n\n * General FAQ\n * Build FAQ\n * Storybook FAQ","routePath":"/module-tools/en/guide/faq/","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":31,"title":"Storybook FAQ","content":"#\n\n\nStorybook v7 Support#\n\nStorybook v7 is now fully supported and has become our recommended version.\n\n\nUsing Storybook Addon or other configurations does not work#\n\nModern.js Module is currently using Storybook version v6, if you are using Addon\nversion v7 you may not be able to get the addon to work.\n\nIn addition to the Addon, other configurations may also have differences. For\nexample, if you modify the preview.js configuration file, Storybook v6 is\nwritten differently than v7:\n\n * v6:Document\n * v7:Document\n\n\nCannot find module 'react-dom/package.json'#\n\nWhen debug Storybook, the following problem occurs:\n\n\n\nYou can install the react-dom dependency in the project.\n\n\n\n\nUnable to locate the specific error message#\n\nSolutions:\n\n 1. Find @storybook/core-server/dist/cjs/dev-server.js\n 2. Find this code: var _await$Promise$all = await Promise.all([preview,\n manager,.\n 3. Modify it:\n\n\n\n\nCan`t find any stories is your Storybook#\n\n\n\nWhen you get a problem like this, you can first open the browser console and\nthere should be some error messages. You can use the error messages to deduce if\nthere is a problem in the code you are writing that is causing Storybook to not\nwork properly.\n\n\nStorybook Adds Proxy Functionality#\n\nStorybook does not provide a solution for this, but there is one in the\nStorybook Issue. In the Modern.js Module, you can:\n\n 1. Add the .storybook/middleware.js file and initialize the following:\n\n\n\n 2. add http-proxy-middleware dependency\n 3. Add proxy routing-related configuration\n\n\n\nLink:https://github.com/storybookjs/storybook/issues/11551\n\n\nTailwind CSS doesn't work in Storybook#\n\nThe Storybook build capability of the Modern.js Module is provided by Rsbuild.\nSince the underlying implementation of Rsbuild is not integrated with Modern.js\nModule, the Modern.js Module plugins do not work in Storybook (Rsbuild).\n\nSolution: Register the tailwindcss PostCSS plugin in storybook.\n\nReference link: Rsbuild - tailwindcss.","routePath":"/module-tools/en/guide/faq/storybook","lang":"en","toc":[{"text":"Storybook v7 Support","id":"storybook-v7-support","depth":2,"charIndex":3},{"text":"Using Storybook Addon or other configurations does not work","id":"using-storybook-addon-or-other-configurations-does-not-work","depth":2,"charIndex":104},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":519},{"text":"Unable to locate the specific error message","id":"unable-to-locate-the-specific-error-message","depth":2,"charIndex":681},{"text":"Can`t find any stories is your Storybook","id":"cant-find-any-stories-is-your-storybook","depth":2,"charIndex":900},{"text":"Storybook Adds Proxy Functionality","id":"storybook-adds-proxy-functionality","depth":2,"charIndex":1200},{"text":"Tailwind CSS doesn't work in Storybook","id":"tailwind-css-doesnt-work-in-storybook","depth":2,"charIndex":1585}],"domain":"","frontmatter":{},"version":""},{"id":32,"title":"Quick Start","content":"#\n\n\n3 minute demo#\n\nWant to experience Modern.js Module in action? The only prerequisite you need is\nNode.js LTS and make sure your Node version is >= 16.0.0.We recommend using the\nLTS version of Node.js 18.\n\n\nCreate new project#\n\nIf you want to create a complete Modern.js Module, you can execute the following\ncommand:\n\n\n\nINFO\n\nExecute npx @modern-js/create -h for more command line arguments\n\nNext, in the issue interaction, follow the options below.\n\n\n\n> The project name is the value of the \"name\" field in package.json.\n\nThen the process of initializing the project will start. After the project\ndirectory and files are generated and the dependencies are installed, a complete\nmodule project is created.\n\nWe can start the project build directly with the pnpm build command, and start\nthe build in watching mode with the pnpm build --watch command.\n\n\nAdd to an existing project#\n\nFrom your shell, install the following dependencies in your project.\n\n * @modern-js/module-tools\n * \"typescript\" (omitted if not a TypeScript project)\n\n> If it's a TypeScript project, add the \"typescript\" dependency.\n\n> For projects that use pnpm or the Yarn package manager, just replace npm. pnpm\n> is recommended.\n\nNext, create the modern.config.(t|j)s file in the root of the project.\n\n\n\nFinally, add the command \"build\": \"modern build\" to the project's package.json\nfile.\n\n\n\nIf your project has a src/index.(js|jsx) file or both src/index.(ts|tsx) and\ntsconfig.json files, then congratulations you can run the npm run build command\ndirectly to build your project with Modern.js Module.\n\n\nCore npm Package#\n\n@modern-js/module-tools is the core npm package of Modern.js Module, providing\nthe following capabilities:\n\n * It offers commonly used CLI commands such as modern dev, modern build, and\n more.\n * It integrates Modern.js Core, providing capabilities for configuration\n parsing, plugin loading, and more.\n * It integrates esbuild and SWC, providing build capabilities.\n * It integrates some commonly used plugins, such as plugin-lint,\n plugin-changeset, and others.\n\n@modern-js/module-tools is implemented based on the plugin system of Modern.js.\nEssentially, it is a plugin. Therefore, you need to register moduleTools in the\nplugins field of the configuration file:\n\n\n\n\nView official example#\n\nIf you want to see the complete project using the Modern.js Module, you can\nexecute the following command.\n\n\n\n\nLet's get started#\n\nChoose your tutorial scenario...\n\n * I'm a beginner and need to learn basic usage of Modern.js Module.\n * I have learned the basic usage of Modern.js Module and can learn advanced\n usage of Modern.js Module.\n * I need to expand my project capabilities and need to learn how to develop\n plugins for Modern.js Module.","routePath":"/module-tools/en/guide/intro/getting-started","lang":"en","toc":[{"text":"3 minute demo","id":"3-minute-demo","depth":2,"charIndex":3},{"text":"Create new project","id":"create-new-project","depth":3,"charIndex":209},{"text":"Add to an existing project","id":"add-to-an-existing-project","depth":3,"charIndex":855},{"text":"Core npm Package","id":"core-npm-package","depth":3,"charIndex":1577},{"text":"View official example","id":"view-official-example","depth":3,"charIndex":2272},{"text":"Let's get started","id":"lets-get-started","depth":2,"charIndex":2407}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":33,"title":"Welcome to Modern.js Module","content":"#\n\nModern.js Module is a modules engineering solution for Modern.js, as well as a\ncore dependency. It allows developers to build, debug, and publish module type\nproject more easily. A module type project can mostly be thought of as an npm\npackage type project, which may be a component, component library or tool\nlibrary project.\n\nIf you are planning to develop a project of the npm package type, then you came\nto the right place! Modern.js provides a professional Modern.js Module. It gives\nyou:\n\n * Simple project initialization: simply execute the npx @modern-js/create\n project-dir command, followed by a few interactive questions, to create a\n complete module type project. The created project also supports the choice of\n two package managers, pnpm and Yarn.\n * Code formatting: In Modern.js Module, you can execute modern lint to format\n the code. The initialized module project includes the ESLint ruleset for\n Modern.js for most scenarios.\n * Comprehensive build capabilities and faster builds: Modern.js Module provides\n high-performance build capabilities based on esbuild and SWC, and provides\n rich configurations for different build scenarios.\n * Storybook debugging tools: Modern.js Module provides Storybook debugging\n tools for debugging module projects. After installing the Storybook plugin\n for Modern.js Module, you can start it with the storybook dev command. You\n can use Storybook not only for debugging components, but also for other types\n of modules.\n * Versioning based on Changesets: When you need to record changes to a project,\n you can use the modern change command to generate a Markdown file containing\n the changes; when you need to upgrade a project, you can use the modern bump\n command to analyze and upgrade the version through the Markdown file; when\n you need to release a project, you can use the modern release command to\n release the project; Modern.js Module implements these commands based on\n Changesets.\n * Extensible plugin mechanism: Want to integrate additional debugging tools for\n your project? Or maybe you want to do some extra processing during the build\n process, Modern.js Module provides a plugin mechanism and plugin hooks that\n cover both the dev command and the build command process. You can use them to\n extend the capabilities of your project.\n * Lots more! Modern.js Module will continue to optimize its build and debug\n features in the future. If there are important issues to be solved in module\n project building, or if a mainstream module project debugging tool or pattern\n emerges, then they will probably be supported by Modern.js Module.","routePath":"/module-tools/en/guide/intro/welcome","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":34,"title":"Why you need Modern.js Module","content":"#\n\nYou've probably all experienced it: when developing a component library or tool\nlibrary from scratch, we have to consider not only how to write the code logic\nof the project itself, but also how to build, debug, test, format the code, and\nother things that have nothing to do with the code logic.\n\nFor example, when we consider which builder is used to build the code for a\nmodule project, we might previously consider webpack or Rollup, but now we might\nalso consider esbuild or SWC.\n\nRegardless of which builder is chosen, this is going to be a costly learning\ncurve for developers who are not skilled in the use of these build tools. Even\nif you want to use them quickly, it will take a lot of time and effort.\n\nIn addition to the build, things like providing debugging tools for projects,\nsupporting testing capabilities, adding code format validation, etc. can take a\nlong time and effort for a novice to understand or master them and actually\nserve the current project.\n\nTo ensure the quality of the code and the integrity of the project, we often\nneed to do these things that are not related to the logical implementation of\nthe code. However, these things are likely to affect the overall project\ndevelopment progress, reduce the developer's development experience, and make\nthe developer feel that the development threshold of the module project is very\nhigh.\n\nIf you have to go through all this work every time you develop a module type\nproject, you will spend most of your development time in the beginning on these\nthings that are not related to code implementation. If we could provide a module\nengineering solution that would help developers to solve the project engineering\nissues and allow them to focus more on code implementation, it would greatly\nimprove the module type project development experience.\n\n\n\nModern.js, in order to make developing module type projects easier, provides a\nmodule engineering solution in order to solve the above mentioned problems and\nprovides the main features using Modern.js Module. Modern.js Module can be\nunderstood as a tool dedicated to the development of module type projects.","routePath":"/module-tools/en/guide/intro/why-module-engineering-solution","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":36,"title":"Quick Start","content":"#\n\nModern.js Module not only provides a rich set of features, but also supports\nextending the capabilities of the current project by way of plugins.\n\nWe can quickly see how to write a Modern.js Module plugin by using the following\nexample.\n\n 1. First we create . /plugins/example.ts file under the initialized project.\n\n\n\n 2. Next add the code for the plugin to the example.ts file.\n\n\n\n 3. Then we register the plugin we just wrote via the plugins API.\n\n\n\n 4. Finally, run modern build and you will see:\n\n\n\nWith the above example, we learned the following things.\n\n * The recommended plugin directory structure\n * The initialization code of the plugin\n * Plugin registration\n\nIn addition to the above, we also need to understand.\n\n * plugin objects, type definitions and recommended configuration options\n * setup functions, api object parameters, lifecycle hooks","routePath":"/module-tools/en/plugins/guide/getting-started","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":37,"title":"Plugin Object","content":"#\n\nThe Modern.js Module plugin is an object, and the object contains the following\nproperties.\n\n * name: The name of the plugin, a unique identifier.\n * setup: plugin initialization function, which will be executed only once.\n setup function can return a Hooks object, and Modern.js Module will execute\n the function corresponding to the Hook defined on the Hooks object at a\n specific time.\n\nFor example, in the following plugin code example, the beforeBuild function is\ntriggered before the project starts the build task and the build start log is\nprinted.\n\n\n\n\n\n\nPlugin type definitions#\n\nWhen using TypeScript, you can introduce the built-in CliPlugin and ModuleTools\ntypes to provide the correct type derivation for plugins: ``\n\n\n\n\nPlugin configuration options#\n\nIt is recommended to write the plugin as a function, so that the plugin can\nreceive configuration options via function entry.\n\n","routePath":"/module-tools/en/plugins/guide/plugin-object","lang":"en","toc":[{"text":"Plugin type definitions","id":"plugin-type-definitions","depth":2,"charIndex":570},{"text":"Plugin configuration options","id":"plugin-configuration-options","depth":2,"charIndex":741}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":38,"title":"Setup function","content":"#\n\nIn the \"Plugin object\" section we know that the plugin object contains a setup\nfunction that not only contains an api object parameter, but also returns a\nHooks object.\n\n\nPlugin API objects#\n\nThe setup function of the plugin will provide an api object parameter, and you\ncan call some of the methods provided on this object to get information about\nthe configuration, project context, etc.\n\n\n\n\napi.useAppContext#\n\nUsed to get project context information.\n\n\n\nINFO\n\nThrough the actual type file, we can see that there are some additional fields.\nHowever, for Modern.js Module, the fields mentioned above are the only ones that\nare meaningful. The same applies to other methods of the api object.\n\n\napi.useResolvedConfigContext#\n\nUsed to get the final configuration after parsing.\n\nINFO\n\nIf you need to get the build-related final configuration, you need to use the\nbeforeBuild Hook.\n\n\n\n\napi.useHookRunners#\n\nUsed to get the executors of Hooks and trigger the execution of a specific Hook.\n\n\n\n\nAsynchronous setup#\n\nThe setup of a CLI plugin can be an asynchronous function that performs\nasynchronous logic during the initialization process.\n\n\n\nNote that the setup function of the next plugin is not executed until the async\nsetup function of the current plugin has finished. Therefore, you should avoid\nperforming time-consuming asynchronous operations in the setup function to avoid\nslowing down the startup performance of the CLI.\n\n\nLife cycle hooks#\n\nWe know that the setup function returns a Hooks object, which can also be\nunderstood as an object with Modern.js Module lifecycle hooks.\n\nCurrently there are two main types of hooks.\n\n * build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * debug hooks: hooks that are triggered when running the dev command.\n\nSee the API documentation for a full list of lifecycle hooks.","routePath":"/module-tools/en/plugins/guide/setup-function","lang":"en","toc":[{"text":"Plugin API objects","id":"plugin-api-objects","depth":2,"charIndex":173},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"Asynchronous setup","id":"asynchronous-setup","depth":2,"charIndex":993},{"text":"Life cycle hooks","id":"life-cycle-hooks","depth":2,"charIndex":1434}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":39,"title":"Overview","content":"#\n\n\nOfficial Plugins#\n\n * @modern-js/plugin-module-import:Use SWC to provide the same ability as\n babel-plugin-import.\n * @modern-js/plugin-module-banner:Add custom content, such as copyright\n information, to the top and bottom of each JS and CSS file.\n * @modern-js/plugin-module-node-polyfill: Inject Polyfills of Node core modules\n in the browser side.\n * @modern-js/plugin-module-polyfill:Inject polyfill for unsupported features\n used in your code.\n * @modern-js/plugin-module-babel:Use Babel to transform your code.\n * @modern-js/plugin-module-vue:Support for Vue component.","routePath":"/module-tools/en/plugins/official-list/overview","lang":"en","toc":[{"text":"Official Plugins","id":"official-plugins","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":40,"title":"Babel Plugin","content":"#\n\nTIP\n\nNormally, we don't need to use Babel to transform our code, this plugin is only\nused as a downgrade.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nYou can also configure the registration via hooks, for example, if you need to\nbundle two files A and B at the same time and only need to use babel when bundle\nA:\n\n\n\n\nConfig#\n\nSee babel options.\n\nHere is an example with @babel/preset-env configured\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-babel","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":110},{"text":"Install","id":"install","depth":3,"charIndex":125},{"text":"Register","id":"register","depth":3,"charIndex":136},{"text":"Config","id":"config","depth":2,"charIndex":372}],"domain":"","frontmatter":{},"version":""},{"id":41,"title":"Banner Plugin","content":"#\n\nProvide the ability to inject content at the top and bottom of each JS and CSS\nfile.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nTIP\n\nNote: CSS comments do not support the //comment syntax. Refer to \"CSS Comments\"\n\n\nExample#\n\n\nAdd copyright information at the top of a JS file#\n\n\n\n\nConfiguration#\n\n * Type\n\n\n\n\nbanner#\n\nAdd content at the top.\n\n * banner.js: Add content at the top of a JS file.\n * banner.css: Add content at the top of a CSS file.\n\n\nfooter#\n\nAdd content at the bottom.\n\n * footer.js: Add content at the bottom of a JS file.\n * footer.css: Add content at the bottom of a CSS file.","routePath":"/module-tools/en/plugins/official-list/plugin-banner","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":89},{"text":"Install","id":"install","depth":3,"charIndex":104},{"text":"Register","id":"register","depth":3,"charIndex":115},{"text":"Example","id":"example","depth":2,"charIndex":271},{"text":"Add copyright information at the top of a JS file","id":"add-copyright-information-at-the-top-of-a-js-file","depth":3,"charIndex":282},{"text":"Configuration","id":"configuration","depth":2,"charIndex":337},{"text":"banner","id":"banner","depth":3,"charIndex":365},{"text":"footer","id":"footer","depth":3,"charIndex":505}],"domain":"","frontmatter":{},"version":""},{"id":42,"title":"Import Plugin","content":"#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\n\nTIP\n\nSince @modern-js/module-tools version >= 2.16.0, this plugin functionality is\nbuilt into Modern.js Module and is provided by transformImport.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nThis way we can use the ability of automatic import in Modern.js Module.\n\n\nConfigurations#\n\n * Type:\n\n\n\n\npluginImport#\n\n * Type: object[]\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\n\nNotes#\n\nSWC (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC\nand ported from babel-plugin-import. The configuration options remain\nconsistent.\n\nSome configurations can be passed in as functions, such as customName,\ncustomStyleName, etc., but in Modern.js Module, we do not recommend using\nfunctions in these configuration items. Because we will call SWC in the esbuild\nplugin, and then when Rust calls these configuration functions through Node-API,\na deadlock will occur.\n\nSimple function logic can actually be replaced by template language. Below is an\nexample of using a template with customName:\n\n\n\nAdd the following configuration on the right-hand side:\n\n\n\nThe {{ member }} in it will be replaced with the corresponding import member.\nAfter transformation:\n\n\n\nTemplate customName: 'foo/es/{{ member }}' is the same as customName: (member)\n=> `foo/es/${member}` , but template value has no performance overhead of\nNode-API.\n\nThe template used here is handlebars. There are some useful builtin tools, Take\nthe above import statement as an example:\n\n\n\nTransformed to:\n\n\n\nIn addition to kebabCase, there are cameraCase, snakeCase, upperCase and\nlowerCase can be used as well.","routePath":"/module-tools/en/plugins/official-list/plugin-import","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":230},{"text":"Install","id":"install","depth":3,"charIndex":245},{"text":"Register","id":"register","depth":3,"charIndex":256},{"text":"Configurations","id":"configurations","depth":2,"charIndex":413},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":443},{"text":"Notes","id":"notes","depth":2,"charIndex":602}],"domain":"","frontmatter":{},"version":""},{"id":43,"title":"Node Polyfill Plugin","content":"#\n\nAbout Node Polyfill\n\nNormally, we don't need to use Node libs on the browser side. However, it is\npossible to use some Node libs when the code will run on both the Node side and\nthe browser side, and Node Polyfill provides browser versions of polyfills for\nthese Node libs.\n\nBy using the Node Polyfill plugin, Node core libs polyfills are automatically\ninjected into the browser-side, allowing you to use these modules on the browser\nside with confidence.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nConfigurations#\n\n * Type:\n\n\n\n\nexclude#\n\nExclude the Node Polyfill to be injected.\n\n\n\n\noverrides#\n\nOverride the built-in Node Polyfill.\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\nWhen the above global variables are used directly in code, the corresponding\npolyfill will be injected.\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\nWhen the above module is referenced in code via import / require syntax, the\ncorresponding polyfill will be injected.\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\nCurrently there is no polyfill for the above modules on the browser side, so\nwhen you import the above modules, it will automatically fallback to an empty\nobject.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-node-polyfill","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":460},{"text":"Install","id":"install","depth":3,"charIndex":475},{"text":"Register","id":"register","depth":3,"charIndex":486},{"text":"Configurations","id":"configurations","depth":2,"charIndex":569},{"text":"exclude","id":"exclude","depth":3,"charIndex":599},{"text":"overrides","id":"overrides","depth":3,"charIndex":655},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":708},{"text":"Globals","id":"globals","depth":3,"charIndex":726},{"text":"Modules","id":"modules","depth":3,"charIndex":877},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":1336}],"domain":"","frontmatter":{},"version":""},{"id":44,"title":"Polyfill Plugin","content":"#\n\nTIP\n\nNormally, we don't need to inject polyfill for npm packages, this step should be\ndone on the web application framework side, but in some scenarios we need to\ninject polyfill in order to make our library run directly in low version\nbrowsers.\n\nNote that this plugin does not transform your code syntax, it only injects\npolyfill for unsupported functions used in your code, importing them as normal\nfunctions instead of polluting the global. You need to install the core-js-pure\ndependency.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nYou can also configure registration via hooks, for example, if you have multiple\nbuild configurations at the same time and only need to inject the polyfill when\nbundle:\n\n\n\n\nConfig#\n\n * Type\n\n\n\n\ntargets#\n\nSee Babel target.\n\nThis is a example.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-polyfill","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":497},{"text":"Install","id":"install","depth":3,"charIndex":512},{"text":"Register","id":"register","depth":3,"charIndex":523},{"text":"Config","id":"config","depth":2,"charIndex":778},{"text":"targets","id":"targets","depth":3,"charIndex":799}],"domain":"","frontmatter":{},"version":""},{"id":45,"title":"Vue Plugin","content":"#\n\nThe Vue plugin provides support for building Vue 3 components. The plugin\ninternally integrates esbuild-plugin-vue3 and @vue/babel-plugin-jsx。\n\nWARNING\n\nNotice that we have some limitation:\n\n 1. The current implementation of this plugin integrates directly with the\n community plugin and therefore does not support writing jsx/tsx in sfc.\n 2. If you want to generate d.ts for the components, please use the official\n recommendation vue-tsc.\n 3. Only support bundle, we recommend to set input to ['src/**/*.vue'] or\n ['src/index.ts'].\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nOptions#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\nOptions passed to @vue/babel-plugin-jsx, please refer to the\n@vue/babel-plugin-jsx documentation for detailed usage.","routePath":"/module-tools/en/plugins/official-list/plugin-vue","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":547},{"text":"Install","id":"install","depth":3,"charIndex":562},{"text":"Register","id":"register","depth":3,"charIndex":573},{"text":"Options","id":"options","depth":2,"charIndex":656},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":667}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file diff --git a/modern-js/module-tools/static/search_index.en.cbc2c9c5.json b/modern-js/module-tools/static/search_index.en.cbc2c9c5.json new file mode 100644 index 0000000000..9cd9cbcbf7 --- /dev/null +++ b/modern-js/module-tools/static/search_index.en.cbc2c9c5.json @@ -0,0 +1 @@ +[{"id":0,"title":"buildConfig","content":"#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. It contains all the configurations related to the build\nprocess.\n\n * Type: object | object[]\n\nTIP\n\nBefore start using buildConfig, please read the following documentation to\nunderstand its purpose:\n\n * Modifying Output Artifacts\n * In-Depth Understanding of the Build Process\n\n\nalias#\n\n * Type: Record | Function\n * Default: {'@': 'src',}\n\nTIP\n\nFor TypeScript projects, you only need to configure compilerOptions.paths in\ntsconfig.json, Modern.js Module will automatically recognize the alias in\ntsconfig.json, so there is no need to configure the alias field additionally.\n\n\n\nAfter the above configuration is done, if @common/Foo.tsx is referenced in the\ncode, it will map to the /src/common/Foo.tsx path.\n\nWhen the value of alias is defined as a function, you can accept the pre-defined\nalias object and modify it.\n\n\n\nIt is also possible to return a new object as the final result in the function,\nwhich will override the pre-defined alias object.\n\n\n\n\nasset#\n\nContains configuration related to static assets.\n\n\nasset.name#\n\nStatic resource output file name.\n\n * Type: string | ((assetPath) => name)\n * Default: [name].[hash].[ext]\n\nWhen asset.name is a string, it will automatically replace [name], [ext], and\n[hash], respectively replaced by the file name, extension, and file hash.\n\nAlso you can use asset.name as a function, and the return is output asset name.\nAt this time, this function receives a parameter assetPath, which corresponds to\nthe resource path.\n\n\n\n\nasset.limit#\n\nUsed to set the threshold for static assets to be automatically inlined as\nbase64.\n\nBy default, Modern.js Module will inline assets such as images, fonts and media\nsmaller than 10KB during bundling. They are Base64 encoded and inlined in the\nbundles, eliminating the need for separate HTTP requests.\n\nYou can adjust this threshold by modifying the limit config.\n\n * Type: number\n * Default: 10 * 1024\n\nFor example, set limit to 0 to avoid assets inlining:\n\n\n\n\nasset.path#\n\nStatic resource output path, will be based on outDir\n\n * Type: string\n * Default: assets\n\n\nasset.publicPath#\n\nThe CDN prefix given to unlinked assets when bundling.\n\n * Type: string\n * Default: undefined\n\n\n\nAt this point, all static assets will be prefixed with https://xxx/.\n\n\nasset.svgr#\n\nPackaged to handle svg as a React component, options reference svgr, plus\nsupport for two configuration options include and exclude to match the svg file\nto be handled\n\n * Type: boolean | object\n * Default: false\n\nWhen svgr feature is enabled, you can use svg as a component using the default\nexport.\n\n\n\nWhen enabled, the type of svg used can be modified by initing a new declaration\nfile and adding to the modern-app-env.d.ts:\n\n\n\n\n\n\nasset.svgr.include#\n\nSet the matching svg file\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: /\\.svg$/\n\n\nasset.svgr.exclude#\n\nSet unmatched svg files\n\n * Type: string | RegExp | (string | RegExp)[]\n * Default: undefined\n\n\nasset.svgr.exportType#\n\nUsed to configure the SVG export type when using SVGR.\n\n * Type: 'named' | 'default'\n * Default: default\n\nwhen it is 'named', use the following syntax:\n\n\n\nThe named export defaults to ReactComponent, and can be customized with the\nasset.svgr.namedExport.\n\n\nautoExtension#\n\nSuffixes for js files and type description files in automation based on format\nand type.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\nWhen disabled, js artifacts are suffixed with .js and type description files are\nsuffixed with d.ts.\n\nWhen enabled, node loads .js as esm by default when type is module, so when we\nwant to output cjs artifacts, the js product is suffixed with .cjs and the type\ndescription file is suffixed with d.cts.\n\nOn the other hand, if the type field is missing or the type is commonjs, node\nloads the .js file as cjs by default. So when we want to output esm output, the\njs output is suffixed with .mjs and the type description file is suffixed with\nd.mts.\n\n:::warning When used in bundleless mode, we have an extra step of processing the\nimport/export statement in each file. We will suffix the relative path to the js\nfile, possibly .mjs or .cjs, depending on your package configuration. You can\ndisable this step by redirect.autoExtension.\n\nNotice noUselessIndex will break this behavior, you should disable it. If you\nneed to use this configuration in bundleless, please patch the index, e.g. if\nutils is a folder, you need to rewrite to\n\n\n\n\nautoExternal#\n\nAutomatically externalize project dependencies and peerDependencies and not\npackage them into the final bundle\n\n * Type: boolean | object\n * Default: true\n\nWhen we want to turn off the default handling behavior for third-party\ndependencies, we can do so by:\n\n\n\nThis way the dependencies under \"dependencies\" and \"peerDependencies\" will be\nbundled. If you want to turn off the processing of only one of these\ndependencies, you can use the buildConfig.autoExternal in the form of an object.\n\n\n\n\nautoExternal.dependencies#\n\nWhether or not the dep dependencies of the external project are needed\n\n * Type: boolean\n * Default: true\n\n\nautoExternal.peerDependencies#\n\nWhether to require peerDep dependencies for external projects\n\n * Type: boolean\n * Default: true\n\n\nbanner#\n\nProvides the ability to inject content into the top and bottom of each JS , CSS\nand DTS file.\n\n\n\n * Type: BannerAndFooter\n * Default: {}\n * Version: >=2.36.0\n\nLet's say you want to add copyright information to JS and CSS files.\n\n\n\n\nbuildType#\n\nThe build type, bundle will package your code, bundleless will only do the code\nconversion\n\n * Type: 'bundle' | 'bundleless'\n * Default: 'bundle'\n\n\ncopy#\n\nCopies the specified file or directory into the build output directory\n\n * Type: object[]\n * Default: []\n\n\n\nReference for array settings: copy-webpack-plugin patterns\n\n\ncopy.patterns#\n\n * Type: CopyPattern[]\n * Default: []\n\n\n\n\ncopy.options#\n\n * Type:\n\n\n\n * Default: { concurrency: 100, enableCopySync: false }\n\n * concurrency: Specifies how many copy tasks to execute in parallel.\n\n * enableCopySync: Uses fs.copySync by default, instead of fs.copy.\n\n\ndefine#\n\nDefine global variables that will be injected into the code\n\n * Type: Record\n * Default: {}\n\nSince the define function is implemented by global text replacement, you need to\nensure that the global variable values are strings. A safer approach is to\nconvert the value of each global variable to a string, as follows.\n\nINFO\n\nModern.js automatically performs JSON serialization handling internally, so\nmanual serialization is not required.\n\nIf automatic serialization is not needed, you can define alias using\nesbuildOptions configuration.\n\n\n\nIf the project is a TypeScript project, then you may need to add the following\nto the .d.ts file in the project source directory.\n\n> If the .d.ts file does not exist, then you can create it manually.\n\n\n\nYou can also replace environment variable:\n\n\n\nWith the above configuration, we can put the following code.\n\n\n\nWhen executing VERSION=1.0.0 modern build, the conversion is:\n\n\n\nTIP\n\nTo prevent excessive global replacement substitution, it is recommended that the\nfollowing two principles be followed when using\n\n * Use upper case for global constants\n * Customize the prefix and suffix of global constants to ensure uniqueness\n\n\ndts#\n\nThe dts file generates the relevant configuration, by default it generates.\n\n * Type: false | object\n * Default:\n\n\n\n\ndts.abortOnError#\n\nWhether to allow the build to succeed if a type error occurs.\n\n * Type: boolean\n * Default: true\n\nBy default, type errors will cause the build to fail. When abortOnError is set\nto false, the build will still succeed even if there are type issues in the\ncode:\n\n\n\nWARNING\n\nWhen this configuration is disabled, there is no guarantee that the type files\nwill be generated correctly. In buildType: 'bundle', which is the bundle mode,\ntype files will not be generated.\n\n\ndts.distPath#\n\nThe output path of the dts file, based on outDir\n\n * Type: string\n * Default: ./\n\nFor example, output to the types directory under the outDir:\n\n\n\n\ndts.enableTscBuild#\n\nEnable the tsc '--build' option. When using project reference, you can use the\n'--build' option to achieve cooperation between projects and speed up the build\nspeed.\n\nThis option requires version > 2.43.0,In fact, we experimentally enabled this\noption in the 2.42.0 version, but the many problems it brought forced us to\nenable it dynamically.\n\n\n\n * Type: boolean\n * Default: false\n * Version: >2.43.0\n\n\n\n\ndts.only#\n\nWhether to generate only type files during the build process without generating\nJavaScript output files.\n\n * Type: boolean\n * Default: false\n\n\n\n\ndts.tsconfigPath#\n\ndeprecated,use tsconfig instead.\n\nSpecifies the path to the tsconfig file used to generate the type file.\n\n\n\n\ndts.respectExternal#\n\nWhen set to false, the type of third-party packages will be excluded from the\nbundle, when set to true, it will determine whether third-party types need to be\nbundled based on externals.\n\nWhen bundle d.ts, export is not analyzed, so any third-party package type you\nuse may break your build, which is obviously uncontrollable. So we can avoid it\nwith this configuration.\n\n * Type: boolean\n * Default: true\n\n\n\n\nesbuildOptions#\n\nUsed to modify the esbuild configuration.\n\n * Type: Function\n * Build Type: Only supported for buildType: 'bundle'\n * Default: c => c\n\nFor example, if we need to modify the file extension of the generated files:\n\n\n\nFor example, register an esbuild plugin:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\nTIP\n\nWe have done many extensions based on the original esbuild build. Therefore,\nwhen using this configuration, pay attention to the following:\n\n 1. Prefer to use the configuration that Modern.js Module provides. For example,\n esbuild does not support target: 'es5', but we support this scenario\n internally using SWC. Setting target: 'es5' through esbuildOptions will\n result in an error.\n 2. Currently, we use enhanced-resolve internally to replace esbuild's resolve\n algorithm, so modifying esbuild resolve-related configurations is invalid.\n We plan to switch back in the future.\n\n\nexternalHelpers#\n\nBy default, the output JS code may depend on helper functions to support the\ntarget environment or output format, and these helper functions will be inlined\nin the file that requires it.\n\nWith this configuration, the code will be converted using SWC, it will inline\nhelper functions to import them from the external module @swc/helpers.\n\n * Type: boolean\n * Default: false\n\nBelow is a comparison of the output file changes before and after using this\nconfiguration.\n\nBefore enable:\n\n\n\nAfter enabled:\n\n\n\n\nexternals#\n\nConfigure external dependencies that will not be bundled into the final bundle.\n\n * Type:\n\n\n\n * Default: []\n * Build Type: Only supported for buildType: 'bundle'\n * Example:\n\n\n\n\nfooter#\n\nSame as the banner configuration for adding a comment at the end of the output\nfile.\n\n\nformat#\n\nUsed to set the output format of JavaScript files. The options iife and umd only\ntake effect when buildType is bundle.\n\n * Type: 'esm' | 'cjs' | 'iife' | 'umd'\n * Default: cjs\n\n\nformat: esm#\n\nesm stands for \"ECMAScript module\" and requires the runtime environment to\nsupport import and export syntax.\n\n * Example:\n\n\n\n\nformat: cjs#\n\ncjs stands for \"CommonJS\" and requires the runtime environment to support\nexports, require, and module syntax. This format is commonly used in Node.js\nenvironments.\n\n * Example:\n\n\n\n\nformat: iife#\n\niife stands for \"immediately-invoked function expression\" and wraps the code in\na function expression to ensure that any variables in the code do not\naccidentally conflict with variables in the global scope. This format is\ncommonly used in browser environments.\n\n * Example:\n\n\n\n\nformat: umd#\n\numd stands for \"Universal Module Definition\" and is used to run modules in\ndifferent environments such as browsers and Node.js. Modules in UMD format can\nbe used in various environments, either as global variables or loaded as modules\nusing module loaders like RequireJS.\n\n * Example:\n\n\n\n\nhooks#\n\nBuild lifecycle hooks that allow custom logic to be injected at specific stages\nof the build process.\n\n * Types:\n\n\n\n * Default: [].\n\nWe can get the compiler instance in the apply method, modify its properties, and\nexecute custom logic at different stages. For more information on Hooks, see\n[Using Hooks to Intervene in the Build Process](see [Using Hooks to Intervene in\nthe Build Process]). For more information on Hooks, see\nUsing-hooks-to-intervene-in-the-build-process.\n\n\n\n\ninput#\n\nSpecify the entry file for the build, in the form of an array that can specify\nthe directory\n\n * Type:\n\n\n\n * Default: ['src/index.ts'] in bundle mode, ['src'] in bundleless mode\n\nArray usage:\n\nIn bundle mode, the following configurations will be built using src/index.ts\nand src/index2.ts as entry points. The bundle mode does not support configuring\ninput as a directory.\n\n\n\nIn bundleless mode, the following configuration compiles both files in the src/a\ndirectory and src/index.ts file.\n\n\n\nIn bundleless mode, Array usage also supports the usage of ! to filter partial\nfiles:\n\n\n\nThe above configuration will build the files in the src directory, and will also\nfilter files with the spec.ts suffix.This is useful in cases where the test\nfiles are in the same root directory as the source files.\n\nObject usage:\n\nWhen you need to modify the output file name in bundle mode, you can use an\nobject configuration.\n\nThe key of the object is the file name of the output, and the value is the file\npath of the source code.\n\n\n\n\njsx#\n\nSpecify the compilation method for JSX, which by default supports React 17 and\nhigher versions and automatically injects JSX runtime code.\n\n * Type: automatic | transform\n * Default: automatic\n\nIf you need to support React 16, you can set jsx to transform:\n\n\n\nTIP\n\nIf you don't need to convert JSX, you can set jsx to preserve, but don't use swc\nto do the code conversion. For more information about JSX Transform, you can\nrefer to the following links:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\nThis option is used for build analysis. When enabled, esbuild will generate\nmetadata about the build in JSON format.\n\n * Type: boolean\n * Default: false\n * Build Type: Only supported for buildType: 'bundle'\n\nTo enable metafile generation:\n\n\n\nAfter executing the build, a metafile-[xxx].json file will be generated in the\noutput directory. You can use tools like esbuild analyze and bundle-buddy for\nvisual analysis.\n\n\nminify#\n\nUse esbuild or terser to compress code, also pass terserOptions\n\n * Type: 'terser' | 'esbuild' | false | object\n * Default: false\n\n\n\n\noutDir#\n\nSpecifies the output directory of the build.\n\n * Type: string\n * Default: ./dist\n\n\n\n\nplatform#\n\nGenerates code for the node environment by default, you can also specify browser\nwhich will generate code for the browser environment. See esbuild.platform learn\nmore.\n\n * Type: 'browser' | 'node'\n * Default: 'node'\n\n\n\n\nredirect#\n\nIn buildType: 'bundleless' build mode, the reference path is redirected to\nensure that it points to the correct product, e.g:\n\n * import '. /index.less' will be rewritten to import '. /index.css'\n * would be rewritten as to `` (depending on the situation)\n * will be rewritten to (if generate utils.mjs, depending on the situation)\n\nIn some scenarios, you may not need these functions, then you can turn it off\nwith this configuration, and its reference path will not be changed after\nturning it off.\n\n\n\n\nresolve#\n\nCustom module resolution options\n\n\nresolve.alias#\n\nThe basic usage is the same as alias.\n\nThe issue with alias is that we incorrectly handled Module IDs in a bundleless\nscenario:\n\n\n\nWhen we configure alias: { react: 'react-native' }, the result becomes:\n\n\n\nA Module ID is incorrectly processed as a relative path, which is not expected.\n\nWe want to fix this issue, but it may break existing projects.\n\nTherefore, in 2.58.0, we provided resolve.alias to solve this problem.\nAdditionally, resolve.alias removed the default value { \"@\": \"./src\"} provided\nby alias.\n\nIf you need this feature, please use resolve.alias.\n\nIn the next major version, resolve.alias will replace alias.\n\nWARNING\n * Note that this configuration should not be mixed with alias.\n * Ensure that this configuration specifies a relative path, such as { \"@\":\n \"./src\" } rather than { \"@\": \"src\"}.\n\n\nresolve.mainFields#\n\nA list of fields in package.json to try when parsing the package entry point.\n\n * Type: string[]\n * Default: depends on platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * Version: >=2.36.0\n\nFor example, we want to load the js:source field first:\n\n\n\nWARNING\n\nresolve.mainFields has a lower priority than the exports field in package.json,\nand if an entry point is successfully resolved from exports, resolve.mainFields\nwill be ignored.\n\n\nresolve.jsExtentions#\n\nSupport for implicit file extensions\n\n * Type: string[]\n * Default: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * Version: >=2.36.0\n\nDo not use implicit file extensions for css files, currently Module only\nsupports ['.less', '.css', '.sass', '.scss'] suffixes.\n\nNode's parsing algorithm does not consider .mjs and cjs as implicit file\nextensions, so they are not included here by default, but can be included by\nchanging this configuration:\n\n\n\n\nshims#\n\nWhen building CommonJS/ESM artifacts, inject some polyfill code such as\n__dirname which can only be used in CommonJS. After enable this option, it will\ncompile __dirname as path.dirname(fileURLToPath(import.meta.url)) when format is\nesm.\n\nSee details here, Note that esm shims will only be injected if platform is node,\nbecause the url module is used.\n\n * Type: boolean\n * Default: false\n * Version: >=2.38.0\n\n\n\n\nsideEffects#\n\nModule sideEffects\n\n * Type: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * Default: undefined\n\nNormally, we configure the module's side effects via the sideEffects field in\npackage.json, but in some cases, The package.json of a third-party package is\nunreliable.Such as when we reference a third-party package style file\n\n\n\nBut the package.json of this third-party package does not have the style file\nconfigured in the sideEffects\n\n\n\nAt the same time you set style.inject to true and you will see a warning message\nlike this in the console\n\n\n\nAt this point, you can use this configuration option to manually configure the\nmodule's \"sideEffects\" to support regular and functional forms.\n\n\n\nTIP\n\nAfter adding this configuration, the sideEffects field in package.json will no\nlonger be read when packaging\n\n\nsourceDir#\n\nSpecify the source directory of the build, default is src, which is used to\ngenerate the corresponding output directory based on the source directory\nstructure when building bundleless. Same as esbuild.outbase.\n\n * Type: string\n * Default: src\n\n\nsourceMap#\n\nWhether to generate sourceMap or not\n\n * Type: boolean | 'inline' | 'external'\n * Default: false\n\n\nsourceType#\n\nSets the format of the source code. By default, the source code will be treated\nas EsModule. When the source code is using CommonJS, you need to set commonjs.\n\n * Type: 'commonjs' | 'module'\n * Default: 'module'\n\n\nsplitting#\n\nWhether to enable code splitting. Only support format: 'esm' and format:\n'cjs',see esbuild.splitting learn more.\n\n * Type: boolean\n * Default: false\n\n\nstyle#\n\nConfigure style-related configuration\n\n\nstyle.less#\n\nless-related configuration\n\n\nstyle.less.lessOptions#\n\nRefer to less for detailed configuration\n\n * Type: object\n * Default: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\nAdd Less code to the beginning of the entry file.\n\n * Type: string\n * Default: undefined\n\n\n\n\nstyle.less.implementation#\n\nConfigure the implementation library used by Less, if not specified, the\nbuilt-in version used is 4.1.3.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Less when the object type is specified.\n\n\n\nFor the string type, specify the path to the implementation library for Less\n\n\n\n\nstyle.sass#\n\nsass-related configuration.\n\n\nstyle.sass.sassOptions#\n\nRefer to node-sass for detailed configuration.\n\n * Type: object\n * Default: {}\n\n\nstyle.sass.additionalData#\n\nAdd Sass code to the beginning of the entry file.\n\n * Type: string | Function\n * Default: undefined\n\n\n\n\nstyle.sass.implementation#\n\nConfigure the implementation library used by Sass, the built-in version used is\n1.5.4 if not specified.\n\n * Type: string | object\n * Default: undefined\n\nSpecify the implementation library for Sass when the object type is specified.\n\n\n\nFor the string type, specify the path to the Sass implementation library\n\n\n\n\nstyle.postcss#\n\nUsed to configure options for PostCSS. The provided values will be merged with\nthe default configuration using Object.assign. Note that Object.assign performs\na shallow copy, so it will completely override the built-in plugins array.\n\nFor detailed configuration, please refer to PostCSS.\n\n * Type:\n\n\n\n * Default:\n\n\n\n * Example:\n\n\n\n\nstyle.inject#\n\nConfigure whether to insert CSS styles into JavaScript code in bundle mode.\n\n * Type: boolean\n * Default: false\n\nSet inject to true to enable this feature:\n\n\n\nOnce enabled, you will see the CSS code referenced in the source code included\nin the bundled JavaScript output.\n\nFor example, if you write import './index.scss' in the source code, you will see\nthe following code in the output:\n\n\n\nTIP\n\nAfter enabling inject, you need to pay attention to the following points:\n\n * @import in CSS files will not be processed. If your CSS file contains\n @import, you need to manually import the CSS file in the JS file (less and\n scss files are not required because they have preprocessing).\n * Consider the impact of sideEffects. By default, our builder assumes that CSS\n has side effects. If the sideEffects field is set in your project or\n third-party package's package.json and does not include this CSS file, you\n will receive a warning:\n\n\n\nYou can resolve this by configuring sideEffects.\n\n\nstyle.autoModules#\n\nEnable CSS Modules automatically based on the filename.\n\n * Type: boolean | RegExp\n * Default: true\n\ntrue : Enables CSS Modules for style files ending with .module.css .module.less\n.module.scss .module.sass filenames\n\nfalse : Disable CSS Modules.\n\nRegExp : Enables CSS Modules for all files that match the regular condition.\n\n\nstyle.modules#\n\nCSS Modules configuration\n\n * Type: object\n * Default: {}\n\nA common configuration is localsConvention, which changes the class name\ngeneration rules for css modules\n\n\n\nFor the following styles\n\n\n\nYou can use styles.boxTitle to access\n\nFor detailed configuration see postcss-modules\n\n\nstyle.tailwindcss#\n\nUsed to modify the configuration of Tailwind CSS.\n\n * Type: object | Function\n * Default:\n\n\n\n\nEnabling Tailwind CSS#\n\nBefore using style.tailwindcss, you need to enable the Tailwind CSS plugin for\nModern.js Module.\n\nPlease refer to the section Using Tailwind CSS for instructions on how to enable\nit.\n\n\nType#\n\nWhen the value is of type object, it is merged with the default configuration\nvia Object.assign.\n\nWhen the value is of type Function, the object returned by the function is\nmerged with the default configuration via Object.assign.\n\nThe rest of the usage is the same as Tailwind CSS: Quick Portal.\n\n\nNotes#\n\nPlease note that:\n\n * If you are using both the tailwind.config.{ts,js} file and tools.tailwindcss\n option, the configuration defined in tools.tailwindcss will take precedence\n and override the content defined in tailwind.config.{ts,js}.\n * If you are using the designSystem configuration option simultaneously, the\n theme configuration of Tailwind CSS will be overridden by the value of\n designSystem.\n\nThe usage of other configurations follows the same approach as the official\nusage of Tailwind CSS. Please refer to tailwindcss - Configuration for more\ndetails.\n\n\ntarget#\n\ntarget is used to set the target environment for the generated JavaScript code.\nIt enables Modern.js Module to transform JavaScript syntax that is not\nrecognized by the target environment into older versions of JavaScript syntax\nthat are compatible with these environments.\n\n * Type:\n\n\n\n * Default: 'es6'\n\nFor example, compile the code to es5 syntax:\n\n\n\n\ntransformImport#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\nWith this configuration, the code will be converted using SWC.\n\n * Type: object[]\n * Default: []\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\nReference the Import Plugin - Notes\n\n\ntransformLodash#\n\nSpecifies whether to modularize the import of lodash and remove unused lodash\nmodules to reduce the code size of lodash.\n\nThis optimization is implemented using babel-plugin-lodash and swc-plugin-lodash\nunder the hood.\n\nWith this configuration, the code will be converted using SWC.\n\n * Type: boolean\n * Default: false\n\nWhen you enable this, Modern.js Module will automatically redirects the code\nreferences of lodash to sub-paths.\n\nFor example:\n\n\n\nThe transformed code will be:\n\n\n\n\ntsconfig#\n\nPath to the tsconfig file\n\n * Type: string\n * Default: tsconfig.json\n * Version: >=2.36.0\n\n\n\n\numdGlobals#\n\nSpecify global variables for external import of umd artifacts\n\n * Type: Record\n * Default: {}\n\n\n\nAt this point, react and react-dom will be seen as global variables imported\nexternally and will not be packed into the umd product, but will be accessible\nby way of global.React and global.ReactDOM\n\n\numdModuleName#\n\nSpecifies the module name of the umd product\n\n * Type: string | Function\n * Default: name => name\n\n\n\nAt this point the umd artifact will go to mount on global.myLib\n\n:::tip\n\n * The module name of the umd artifact must not conflict with the global\n variable name.\n * Module names will be converted to camelCase, e.g. my-lib will be converted to\n myLib, refer to toIdentifier. :::\n\nAlso the function form can take one parameter, which is the output path of the\ncurrent package file\n\n","routePath":"/module-tools/en/api/config/build-config","lang":"en","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":378},{"text":"asset","id":"asset","depth":2,"charIndex":1054},{"text":"asset.name","id":"assetname","depth":2,"charIndex":1113},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":1571},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":2045},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":2149},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":2336},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":2783},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":2901},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":3018},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":3299},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":4498},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":5006},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":5142},{"text":"banner","id":"banner","depth":2,"charIndex":5273},{"text":"buildType","id":"buildtype","depth":2,"charIndex":5514},{"text":"copy","id":"copy","depth":2,"charIndex":5674},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":5850},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":5908},{"text":"define","id":"define","depth":2,"charIndex":6133},{"text":"dts","id":"dts","depth":2,"charIndex":7312},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":7435},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":7919},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":8081},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":8508},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":8664},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":8793},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":9225},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":10401},{"text":"externals","id":"externals","depth":2,"charIndex":10923},{"text":"footer","id":"footer","depth":2,"charIndex":11113},{"text":"format","id":"format","depth":2,"charIndex":11209},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":11396},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":11536},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":11732},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":12026},{"text":"hooks","id":"hooks","depth":2,"charIndex":12329},{"text":"input","id":"input","depth":2,"charIndex":12816},{"text":"jsx","id":"jsx","depth":2,"charIndex":13845},{"text":"metafile","id":"metafile","depth":2,"charIndex":14376},{"text":"minify","id":"minify","depth":2,"charIndex":14805},{"text":"outDir","id":"outdir","depth":2,"charIndex":14948},{"text":"platform","id":"platform","depth":2,"charIndex":15042},{"text":"redirect","id":"redirect","depth":2,"charIndex":15273},{"text":"resolve","id":"resolve","depth":2,"charIndex":15789},{"text":"resolve.alias","id":"resolvealias","depth":3,"charIndex":15834},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":16667},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":17160},{"text":"shims","id":"shims","depth":2,"charIndex":17625},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":18046},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":18895},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":19153},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":19264},{"text":"splitting","id":"splitting","depth":2,"charIndex":19491},{"text":"style","id":"style","depth":2,"charIndex":19654},{"text":"style.less","id":"styleless","depth":2,"charIndex":19702},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":19744},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":19869},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":19990},{"text":"style.sass","id":"stylesass","depth":2,"charIndex":20335},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":20378},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":20484},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":20616},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":20956},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":21304},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":22317},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":22664},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":22964},{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":3,"charIndex":23078},{"text":"Type","id":"type","depth":3,"charIndex":23287},{"text":"Notes","id":"notes","depth":3,"charIndex":23592},{"text":"target","id":"target","depth":2,"charIndex":24175},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":24539},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":24895},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":25396},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":25501},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":25812}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":1,"title":"buildPreset","content":"#\n\nA build preset string or preset function. Provides out-of-the-box build\nconfiguration\n\n * Type: string | Function\n\n\nnpm-library#\n\nLibrary generic schema used under class NPM package manager, contains esm and\ncjs bundle artifacts, and includes a type file.\n\nINFO\n\nAbout the class NPM Package Manager\n\n * npm\n * yarn\n * pnpm\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-library-with-umd#\n\nUsed under class NPM package manager, and Library supports a similar pattern to\nunpkg. Additional umd artifacts are provided on top of the pre-defined\nnpm-library.\n\n\n\nThe build configuration corresponding to the preset string.\n\n\n\n\nnpm-component#\n\nA generic pattern for components (libraries) used under the class NPM package\nmanager. Contains both esm and cjs Bundleless artifacts (for easy Tree shaking\noptimization), as well as including a copy of the type file.\n\nFor style files included in the source code, the artifacts provide the compiled\nfiles of the style and the source file of the style.\n\n\n\nThe pre-defined strings correspond to the build configuration.\n\n\n\n\nnpm-component-with-umd#\n\nComponent (library) used under class NPM package manager, with support for class\nunpkg schema. Additional umd artifacts are provided on top of the pre-defined\nnpm-component.\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\nWhen you want to use a buildPreset preset that supports other ECMAScript\nversions, you can directly add the supported versions to the 'npm-library',\n'npm-library-with-umd', 'npm-component', 'npm-component-with-umd' presets.\n\nFor example, if you want the 'npm-library' preset to support 'es2017', you can\nconfigure it as follows.\n\n\n\n\nstring / function#\n\nThe buildPreset not only supports basic string forms, but also function forms,\nwhich can obtain the default values we provide through the preset or extend\nPreset parameter and then modify them.\n\nHere are two examples using preset and extend Preset:\n\n\n\nIn the extend Preset, lodash.merge is used for configuration merge.\n\n","routePath":"/module-tools/en/api/config/build-preset","lang":"en","toc":[{"text":"`npm-library`","id":"npm-library","depth":3,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":3,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":3,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":3,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":3,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":1651}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":2,"title":"dev","content":"#\n\nThis section describes all configuration of Modern.js Module related to\ndebugging tools.\n\n\nstorybook#\n\nWARNING\n\nDeprecated: This configuration is deprecated and only applicable to Storybook\nV6. Please see 使用Storybook to get more info.\n\n\nstorybook.webpack#\n\n * Type: object | Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpack. The usage can be found in the tools.webpack configuration\nof Modern.js Builder.\n\n\n\nConfigure Manager App#\n\nFor the webpack configuration of the Storybook Manager app section, you can\nconfigure it by adding the ./config/storybook/main.js file to configure it.\n\n\n\n\nstorybook.webpackChain#\n\n * Type: Function | undefined\n * Default: undefined\n\n\n\nYou can modify the webpack configuration of the Storybook Preview-iframe via\ndev.storybook.webpackChain. You can refer to Modern.js Builder's\ntools.webpackChain configuration for how to use it.","routePath":"/module-tools/en/api/config/dev","lang":"en","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":93},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":239},{"text":"Configure Manager App","id":"configure-manager-app","depth":4,"charIndex":506},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":686}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":3,"title":"plugins","content":"#\n\nThis chapter describes the configuration of the registered Modern.js Module\nplugin.\n\n * Type: ModuleToolsPlugin[]\n * Default: undefined\n\n\nPlugin Execution Order#\n\nBy default, custom plugins are executed in the order specified in the plugins\narray. The execution of built-in plugins provided by Modern.js Module happens\nbefore the execution of custom plugins.\n\nWhen plugins use fields that control the execution order, such as pre and post,\nthe execution order is adjusted based on the declared fields. For more\ninformation, please refer to the Relationship Between Plugins guide.\n\n\nDeveloping Plugins#\n\nTo learn how to write plugins, please refer to the Plugin Writing Guide.\n\n\nExample#\n\n\nUsing Plugins from npm#\n\nTo use plugins from npm, you need to install them using a package manager and\nimport them in your configuration file.\n\n\n\nUsing Local Plugins#\n\nTo use plugins from a local code repository, you can directly import them using\na relative path.\n\n\n\n\nPlugin Configuration#\n\nIf a plugin provides custom configuration options, you can pass the\nconfiguration through the plugin function's parameters.\n\n","routePath":"/module-tools/en/api/config/plugins","lang":"en","toc":[{"text":"Plugin Execution Order","id":"plugin-execution-order","depth":2,"charIndex":140},{"text":"Developing Plugins","id":"developing-plugins","depth":2,"charIndex":584},{"text":"Example","id":"example","depth":2,"charIndex":680},{"text":"Using Plugins from npm","id":"using-plugins-from-npm","depth":3,"charIndex":691},{"text":"Using Local Plugins","id":"using-local-plugins","depth":4,"charIndex":837},{"text":"Plugin Configuration","id":"plugin-configuration","depth":3,"charIndex":960}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":4,"title":"Overview","content":"#","routePath":"/module-tools/en/api/","lang":"en","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"Overview","sidebar_position":1},"version":""},{"id":5,"title":"Plugin Hooks","content":"#\n\nThis chapter describes the lifecycle hooks supported by module-tools.\n\nCurrently there are following main types of lifecycle hooks.\n\n * Config hooks: change user config.\n * Build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * dev hooks: hooks that are triggered when running the dev command.\n\nHook Model is explained in detail here.\n\n\nConfig hooks#\n\n\nresolveModuleUserConfig#\n\nchang user config.\n\ntype: AsyncWaterfall\n\n\n\n\nbuild hooks#\n\nThe following Hooks are triggered in order when the build command is executed.\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\nTriggered before the execution of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters value types.\n\n\n\n> BuildConfig type reference API configuration\n\n\nbeforeBuildTask#\n\nBased on the build configuration, Modern.js Module will split the overall build\ninto multiple sub-build tasks. The Hook will be triggered before each build\nsubtask.\n\ntype: AsyncWaterfall\n\n\n\nParameters and return value types.\n\nBaseBuildConfig type reference API configuration\n\n\nafterBuildTask#\n\nTriggered after the end of each build subtask.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nafterBuild#\n\nTriggered after the end of the overall build process.\n\ntype: ParallelWorkflow\n\n\n\nParameters and return value types.\n\n\n\n\nbuildPlatform hooks#\n\nmodule-tools also provides the build --platform command to perform specific\nbuild tasks.\n\nFor example, after installing the Module Doc plugin, you can run build\n--platform or build --platform doc to perform Doc build tasks.\n\nHooks are triggered in the following order after executing build --platform.\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\nGets information about the tasks that need to be run when executing the build\n--platform command.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeBuildPlatform#\n\nTriggers all registered build tasks when the build --platform command is\nexecuted. beforeBuildPlatform will be triggered before the execution of the\noverall build task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. buildPlatform will be triggered before each build task is\nexecuted.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterBuildPlatform#\n\nWhen the build --platform command is executed, all registered build tasks will\nbe triggered. afterBuildPlatform will be triggered after the overall platform\nbuild task is finished.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nDev Hooks#\n\nThe following Hooks are triggered in order when the dev command is executed.\n\n * registerDev: triggered when getting dev function information.\n * beforeDev: Triggered before starting the dev process as a whole.\n * beforeDevMenu: triggered before the dev list/menu appears.\n * afterDevMenu: triggered after dev list/menu option is selected.\n * beforeDevTask: Triggered before executing the dev task.\n * afterDev: Triggered at the end of the overall dev process.\n\n\nregisterDev#\n\nRegister dev tool related data. Mainly contains.\n\n * the name of the dev tool\n * The name of the item displayed in the menu list and the corresponding value.\n * The definition of the dev subcommand.\n * Whether to execute the source code build before running the dev task\n * The function to execute the dev task.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDev#\n\nTriggered before the dev task is executed after all dev tool metadata has been\ncollected.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu is triggered before the dev list/menu appears. Receives inquirer\nquestion as argument. Default value is.\n\n\n\nafterDevMenu Triggered after selecting dev list/menu options.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nbeforeDevTask#\n\nTriggered before the dev task is executed.\n\n\n\nTypes of parameters entered and returned.\n\n\n\n\nafterDev#\n\nTriggered when the dev task process is interrupted.\n\n","routePath":"/module-tools/en/api/plugin-api/plugin-hooks","lang":"en","toc":[{"text":"Config hooks","id":"config-hooks","depth":2,"charIndex":509},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"build hooks","id":"build-hooks","depth":2,"charIndex":596},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform hooks","id":"buildplatform-hooks","depth":2,"charIndex":1494},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"Dev Hooks","id":"dev-hooks","depth":2,"charIndex":2796},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":6,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-exception","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":7,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-other","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":8,"title":"","content":"","routePath":"/module-tools/en/components/faq-build-product","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":9,"title":"","content":"","routePath":"/module-tools/en/components/faq-storybook","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":10,"title":"","content":"","routePath":"/module-tools/en/components/publish-emo","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":11,"title":"","content":"When adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.","routePath":"/module-tools/en/components/register-esbuild-plugin","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":12,"title":"","content":"","routePath":"/module-tools/en/components/release-module-doc","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":13,"title":"Handle static assets","content":"#\n\nModern.js Module will handle static assets used in the code. If configuration is\nrequired, then the buildConfig.asset API can be used.\n\n\nDefault behavior#\n\nBy default, Modern.js Module handles the following static assets:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\nFor the handling of static files, Modern.js Module currently supports the\nfollowing functions.\n\n * Set the static asset path to . /assets.\n * Files less than 10kb will be inlined into the code.\n\n\nExample#\n\nLet us look at the following example:\n\n * Project source code:\n\n\n\n * If the size of bg.png is less than 10 kb, then the output directory structure\n and file content are.\n\n\n\n\n\n * If the size of bg.png is larger than 10 kb, then the output directory\n structure and file content are.\n\n\n\n\n\nWhen wanting to modify the default behavior, the following API can be used:\n\n * asset.path: modify the output path of the static assets.\n * asset.limit: modify the threshold value for inline assets.","routePath":"/module-tools/en/guide/advance/asset","lang":"en","toc":[{"text":"Default behavior","id":"default-behavior","depth":2,"charIndex":139},{"text":"Example","id":"example","depth":2,"charIndex":571}],"domain":"","frontmatter":{"sidebar_position":6},"version":""},{"id":14,"title":"Build umd artifacts","content":"#\n\nThe full name of umd is Universal Module Definition, and JS files in this format\ncan run in multiple runtime environments: the\n\n * Browser environment: module loading based on AMD specification\n * Node.js environment: module loading based on CommonJS\n * Other cases: mount the module on a global object.\n\nWe can therefore specify the build artifacts of the project as an umd artifact\nin the following way:\n\n\n\n\nThird-party dependency handling for umd artifacts#\n\nIn the \"How to handle third-party dependencies\" chapter, we know that we can\ncontrol whether or not the project packages third-party dependencies via the\nautoExternals and externals APIs. So when building umd artifacts, we can also\nuse it like this:\n\n\nExample#\n\n * If the project depends on react:\n\n\n\n * modern.config.ts:\n\n\n\n * When a react dependency is used in the source code:\n\n\n\n * The react code is not bundled into the artifact at this point:\n\n\n\nWe know from the above example that when using the autoExternal and externals\nAPIs.\n\n * In a Node.js environment, you can get the react dependency with\n require('react').\n * In a browser environment, you can get the react dependency via global.react.\n\n\nGlobal variable names of third-party dependencies#\n\nHowever, in the browser environment, when getting third-party dependencies,\nglobal variable names are not necessarily identical to the dependency names, so\nyou have to use the buildConfig.umdGlobals API.\n\nAgain using the previous example, when the react dependency exists in the\nbrowser environment as a windows.React or global.React global variable, then:\n\n * modern.config.ts config file:\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nAt this point we will see the output code like this:\n\n\n\nThe project can then run in the browser and use the React variables that exist\non the global object.\n\n\nChanging the name of a global variable in a project#\n\nWhen we package the following code into an umd artifact and run it in the\nbrowser, we can use the module via window.index.\n\n\n\n** By default, the name of the source file is used as the name of the module's\nglobal variable in the browser. **For the above example, the artifact would read\nas follows:\n\n\n\nIf you need to modify it, you need to use the buildConfig.umdModuleName API.\n\nWhen this API is used:\n\n\n\nThe build artifact at this point are:\n\n","routePath":"/module-tools/en/guide/advance/build-umd","lang":"en","toc":[{"text":"Third-party dependency handling for umd artifacts","id":"third-party-dependency-handling-for-umd-artifacts","depth":2,"charIndex":412},{"text":"Example","id":"example","depth":3,"charIndex":716},{"text":"Global variable names of third-party dependencies","id":"global-variable-names-of-third-party-dependencies","depth":3,"charIndex":1171},{"text":"Changing the name of a global variable in a project","id":"changing-the-name-of-a-global-variable-in-a-project","depth":2,"charIndex":1831}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":15,"title":"Use the Copy Tools","content":"#\n\nModern.js Module provides the Copy utility for copying already existing\nindividual files or entire directories into the output directory. Next we learn\nhow to use it.\n\n\nUnderstanding the Copy API#\n\nWe can use the Copy tool via the buildConfig.copy API, which contains the\nfollowing two main configurations.\n\n * patterns\n * options\n\n\nAPI Description#\n\ncopy.patterns is used to find files to be copied and configure the output path.\n\nThe patterns.from parameter is used to specify the file or directory to be\ncopied. It accepts either a Glob pattern string or a specific path. A Glob\npattern string refers to the fast-glob pattern syntax. Therefore, we can use it\nin two ways as follows:\n\n\n\nThe patterns.context parameter is generally used in conjunction with\npatterns.from. By default, its value is the same as buildConfig.sourceDir.\nTherefore, we can specify the file src/data.json to be copied in the following\nway:\n\n> By default, buildConfig.sourceDir is set to src.\n\n\n\nWhen the specified file is not in the source code directory, you can modify the\ncontext configuration. For example, to specify the file temp/index.html in the\nproject directory to be copied:\n\n\n\nThe patterns.to parameter is used to specify the output path for the copied\nfiles. By default, its value corresponds to buildConfig.outDir. Therefore, we\ncan copy src/index.html to the dist directory as follows:\n\n\n\nWhen we configure patterns.to:\n\n * If it is a relative path, the path will be calculated relative to\n buildConfig.outDir to determine the absolute path for copying the files.\n * If it is an absolute path, the value will be used directly.\n\nFinally, patterns.globOptions is used to configure the globby object for finding\nfiles to copy. Its configuration can be referenced from:\n\n * globby.options\n\n\nExamples of Different Scenarios#\n\n\nCopying Files#\n\n\n\n\nCopying Files to a Directory#\n\n\n\n\nCopying from Directory to Directory#\n\n\n\n\nCopying from Directory to File#\n\n\n\n\nUsing Glob#\n\n","routePath":"/module-tools/en/guide/advance/copy","lang":"en","toc":[{"text":"Understanding the Copy API","id":"understanding-the-copy-api","depth":2,"charIndex":171},{"text":"API Description","id":"api-description","depth":2,"charIndex":335},{"text":"Examples of Different Scenarios","id":"examples-of-different-scenarios","depth":2,"charIndex":1783},{"text":"Copying Files","id":"copying-files","depth":3,"charIndex":1818},{"text":"Copying Files to a Directory","id":"copying-files-to-a-directory","depth":3,"charIndex":1837},{"text":"Copying from Directory to Directory","id":"copying-from-directory-to-directory","depth":3,"charIndex":1871},{"text":"Copying from Directory to File","id":"copying-from-directory-to-file","depth":3,"charIndex":1912},{"text":"Using Glob","id":"using-glob","depth":3,"charIndex":1948}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":16,"title":"Handle third-party dependencies","content":"#\n\nGenerally, third-party dependencies required by a project can be installed via\nthe install command in the package manager. After the third-party dependencies\nare successfully installed, they will generally appear under dependencies and\ndevDependencies in the project package.json.\n\n\n\nDependencies under \"dependencies\" are generally related to project code and\nbuilds, and if these third-party dependencies are declared under\n\"devDependencies\", then there will be missing dependencies in production\nenvironments.\n\nIn addition to \"dependencies\", \"peerDependencies\" can also declare dependencies\nthat are needed in the production environment, but it puts more emphasis on the\nexistence of these dependencies declared by \"peerDependencies\" in the project's\nruntime environment, similar to the plugin mechanism.\n\n\nDefault handling of third-party dependencies#\n\nBy default, third-party dependencies under \"dependencies\" and \"peerDependencies\"\nare not bundled by Modern.js Module.\n\nThis is because when the npm package is installed, its \"dependencies\" will also\nbe installed. By not packaging \"dependencies\", you can reduce the size of the\npackage product.\n\nIf you need to package some dependencies, it is recommended to move them from\n\"dependencies\" to \"devDependencies\", which is equivalent to prebundle the\ndependencies and reduces the size of the dependency installation.\n\n\nExample#\n\nIf the project has a dependency on react.\n\n\n\nWhen a react dependency is used in the source code:\n\n\n\nThe react code is not bundled into the artifact:\n\n\n\nIf you want to modify the default processing, you can use the following API.\n\n * buildConfig.autoExternal\n\n\nExclude specified third-party dependencies#\n\nWe mentioned above the use of the buildConfig.autoExternal API, and\nbuildConfig.externals can control which third-party dependencies to handle the\nproject's dependencies in a more granular way.\n\nFor example, when we need to leave only certain dependencies unpacked, we can\nconfigure it as follows.\n\n> In this case, it is likely that some dependencies are not suitable for\n> packaging. If this is the case, then you can handle it as follows.\n\n","routePath":"/module-tools/en/guide/advance/external-dependency","lang":"en","toc":[{"text":"Default handling of third-party dependencies","id":"default-handling-of-third-party-dependencies","depth":2,"charIndex":811},{"text":"Example","id":"example","depth":3,"charIndex":1373},{"text":"Exclude specified third-party dependencies","id":"exclude-specified-third-party-dependencies","depth":2,"charIndex":1643}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":17,"title":"In-depth understanding of build","content":"#\n\nIn the \"Basic Usage\" section, we already knew that you can modify the output\nfiles of a project through the buildConfig configuration. buildConfig not only\ndescribes some of the features of the product, but also provides some\nfunctionality for building the product.\n\nTIP\n\nIf you are not familiar with buildConfig, please read modify-output-product.\n\nIn this chapter we'll dive into the use of certain build configurations and\nunderstand what happens when the modern build command is executed.\n\n\nbundle / bundleless#\n\nSo first let's understand bundle and bundleless.\n\nA bundle is a package of build artifacts, which may be a single file or multiple\nfiles based on a certain code splitting strategy.\n\nbundleless, on the other hand, means that each source file is compiled and built\nseparately, but not bundled together. Each output file can be found with its\ncorresponding source code file. The process of bundleless build can also be\nunderstood as the process of code conversion of source files only.\n\nThey have their own benefits.\n\n * bundle can reduce the size of build artifacts and also pre-package\n dependencies to reduce the size of installed dependencies. Packaging\n libraries in advance can speed up application project builds.\n * bundleless maintains the original file structure and is more conducive to\n debugging and tree shaking.\n\nWARNING\n\nbundleless is a single-file compilation mode, so for referencing and exporting\ntypes, you need to add the type keyword. For example, ``. Please refer to the\nesbuild documentation for more information.\n\nIn buildConfig you can specify whether the current build task is bundle or\nbundleless by using buildConfig.buildType.\n\n\ninput / sourceDir#\n\nbuildConfig.input is used to specify the path to a file or directory from which\nto read the source code, the default value of which varies between bundle and\nbundleless builds:\n\n * When buildType: 'bundle', input defaults to src/index.(j|t)sx?.\n * When buildType: 'bundleless', input defaults to ['src'].\n\nFrom the default value, we know that building in bundle mode usually specifies\none or more files as the entry point for the build, while building in bundleless\nmode specifies a directory and uses all the files in that directory as the entry\npoint.\n\nsourceDir is used to specify the source directory, which is only related to the\nfollowing two elements:\n\n * Type file generation\n * outbase for specifying the build process\n\nSo we can get its best practices:\n\n * Only specify input during the bundle build.\n * In general, bundleless only needs to specify sourceDir (where input will be\n aligned with sourceDir). If we want to use the input in bundleless, we only\n need to specify sourceDir.\n\nIf you want to convert only some of the files in bundleless, e.g. only the files\nin the src/runtime directory, you need to configure input:\n\n\n\n\nuse swc#\n\nIn some scenarios, esbuild is not enough to meet our needs, and we will use swc\nto do the code conversion.\n\nStarting from version 2.36.0, the Modern.js Module will use swc by default when\nit comes to the following functionality, but that doesn't mean we don't use\nesbuild any more, the rest of the functionality will still use esbuild.\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\nIn fact, we've been using swc for full code conversion since version 2.16.0.\nHowever, swc also has some limitations, so we added sourceType to turn off swc\nwhen the source is formatted as 'commonjs', which isn't really user-intuitive,\nand the cjs mode of the swc formatted outputs don't have annotate each export\nname, which can cause problems in node. So we deprecated this behaviour and went\nback to the original design - using swc as a supplement only in situations where\nit was needed.\n\n\nUsing Hooks to Intervene in the Build Process#\n\nThe Modern.js Module provides a Hook mechanism that allows us to inject custom\nlogic at different stages of the build process. The Modern.js Module Hook is\nimplemented using tapable, which extends esbuild's plugin mechanism, and is\nrecommended to be used directly if esbuild plugins already meet your needs.\nHere's how to use it:\n\n\nHook type#\n\nAsyncSeriesBailHook#\n\nSerial hooks that stop the execution of other tapped functions if a tapped\nfunction returns a non-undefined result.\n\nAsyncSeriesWaterFallHooks#\n\nSerial hooks whose results are passed to the next tapped function.\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * Triggered at esbuild onLoad callbacks to fetch module content based on the\n module path\n * Input parameters\n\n\n\n * Return parameters\n\n\n\n * Example\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onLoad callbacks. Transforms the contents of the module\n fetched during the load phase\n * Input parameters (return parameters)\n\n\n\n * Example\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * Triggered at esbuild onEnd callbacks. This is similar to the transform hook,\n but works on the artifacts generated by esbuild.\n * Input parameters (return parameters)\n\n\n\n * Examples\n\n\n\n\ndts#\n\nThe buildConfig.dts configuration is mainly used for type file generation.\n\n\nTurn off type generation#\n\nType generation is turned on by default, if you need to turn it off, you can\nconfigure it as follows:\n\n\n\nTIP\n\nThe build speed is generally improved by closing the type file.\n\n\nBuild type files#\n\nWith buildType: 'bundleless', type files are generated using the project's tsc\ncommand to complete production.\n\nThe Modern.js Module also supports bundling of type files, although care needs\nto be taken when using this feature.\n\n * Bundle type files does not enable type checking.\n * Some third-party dependencies have incorrect syntax that can cause the\n bundling process to fail. So in this case, you need to exclude such\n third-party packages manually with buildConfig.externals or close\n dts.respectExternal to external all third-party packages types.\n * It is not possible to handle the case where the type file of a third-party\n dependency points to a .ts file. For example, the package.json of a\n third-party dependency contains something like this: {\"types\": \".\n /src/index.ts\"}.\n\nFor the above problems, our recommended approach is to first use tsc to generate\nd.ts files, then package the index.d.ts as the entry and close\ndts.respectExternal. In the future evolution, we will gradually move towards\nthis handling approach.\n\n\nAlias Conversion#\n\nDuring the bundleless build process, if an alias appears in the source code,\ne.g.\n\n\n\nThe type files generated with tsc will also contain these aliases. However,\nModern.js Module will convert the aliases in the type file generated by tsc.\n\n\nSome examples of the use of dts#\n\nGeneral usage:\n\n\n\nFor the use of dts.only:\n\n\n\n\nBuild process#\n\nWhen the modern build command is executed, the\n\n * Clear the output directory according to buildConfig.outDir.\n * Compile js/ts source code to generate the JS build artifacts for\n bundle/bundleless.\n * Generate bundle/bundleless type files using tsc.\n * Handle Copy tasks.\n\n\nBuild errors#\n\nWhen a build error occurs, based on the information learned above, it is easy to\nunderstand what error appears in the terminal.\n\nErrors reported for js or ts builds:\n\n\n\nErrors reported for the type file generation process:\n\n\n\nFor js/ts build errors, we can tell from the error message.\n\n * By 'bundle failed:' to determine if the error is reported for a bundle build\n or a bundleless build\n * What is the format of the build process\n * What is the target of the build process\n * The specific error message\n\n\nDebug mode#\n\nFrom 2.36.0, For troubleshooting purposes, the Modern.js Module provides a debug\nmode, which you can enable by adding the DEBUG=module environment variable when\nexecuting a build.\n\n\n\nIn debug mode, you'll see more detailed build logs output in Shell, which are\nmainly process logs:\n\n\n\nIn addition, Module provides the ability to debug internal workflows. You can\nenable more detailed debugging logging by setting the DEBUG=module:* environment\nvariable.\n\nCurrently, only DEBUG=module:resolve is supported, which allows you to see a\ndetailed log of module resolution within the Module.\n\n","routePath":"/module-tools/en/guide/advance/in-depth-about-build","lang":"en","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"use swc","id":"use-swc","depth":2,"charIndex":2845},{"text":"Using Hooks to Intervene in the Build Process","id":"using-hooks-to-intervene-in-the-build-process","depth":2,"charIndex":3803},{"text":"Hook type","id":"hook-type","depth":3,"charIndex":4183},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":4195},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":4334},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":4431},{"text":"load","id":"load","depth":4,"charIndex":4442},{"text":"transform","id":"transform","depth":4,"charIndex":4626},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":4837},{"text":"dts","id":"dts","depth":2,"charIndex":5071},{"text":"Turn off type generation","id":"turn-off-type-generation","depth":3,"charIndex":5154},{"text":"Build type files","id":"build-type-files","depth":3,"charIndex":5357},{"text":"Alias Conversion","id":"alias-conversion","depth":3,"charIndex":6424},{"text":"Some examples of the use of `dts`","id":"some-examples-of-the-use-of-dts","depth":3,"charIndex":-1},{"text":"Build process","id":"build-process","depth":2,"charIndex":6764},{"text":"Build errors","id":"build-errors","depth":2,"charIndex":7057},{"text":"Debug mode","id":"debug-mode","depth":2,"charIndex":7582}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":18,"title":"In-depth understanding of the dev command","content":"#\n\nThe dev command provided by the Modern.js Module is mainly used for debugging\nthe code.\n\n\nThe overall flow of the command run#\n\n 1. When the dev command is executed, Modern.js Module starts looking for\n debugging tools or tasks that can be executed. A debugging tool or task is a\n Modern.js Module debugging tool plugin like module doc.\n 2. When a debugging tool is found, it is executed immediately.\n 3. When multiple debugging tools are found, the debugging tools list menu is\n displayed. A debug tool can be started by selecting the name option\n corresponding to it.\n 4. When no debug tool is found, the user is informed that no debug tool is\n available.\n\nIn addition to the dev command, you can also start a debugging tool or task\ndirectly by using the dev [debug tool name] option.\n\n\nExtending the dev command#\n\nIf you need to extend the dev command, or rather provide your own Modern.js\nModule debugging tool plugin, then you will need to know the following first.\n\n * Development of plugins\n * Debugging Tools Plugin API\n\nIn general, the code to implement a debugging tool that does nothing and the\nassociated configuration is as follows.\n\n\n\nIf this debugging tool plugin is required, it needs to be added to the\nconfiguration file.\n\n\n\nAt this point we can execute it when we execute the dev or dev do-nothing\ncommand. After execution, it will first execute the source build task in\nlistening mode and print the log messages immediately afterwards.\n\nFor currently officially supported debugging tools and third-party supported\ndebugging tools, you can view them in plugins list.","routePath":"/module-tools/en/guide/advance/in-depth-about-dev-command","lang":"en","toc":[{"text":"The overall flow of the command run","id":"the-overall-flow-of-the-command-run","depth":2,"charIndex":92},{"text":"Extending the dev command","id":"extending-the-dev-command","depth":2,"charIndex":806}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":19,"title":"Before you start","content":"#\n\n\nEnvironment preparation#\n\nIn order to use the Modern.js Module, you first need NodeJS engine, we recommend\nthe latest LTS version, and make sure the Node version is >=16.0.0. because\nnon-stable NodeJS releases frequently have bugs. You might consider installing\nvia nvm-windows and nvm (Mac / Linux), so you can easily switch to different\nNodeJS versions that might be required for different projects that you work on.\n\n\nGetting Started with npm#\n\nOnce NodeJS is installed, not only can you access the node executable from the\ncommand line, but you can also execute the npm command.\n\nNpm is the standard package manager for NodeJS. It started out as a tool for\ndownloading and managing NodeJS package dependencies, but it has since evolved\ninto a tool for front-end JavaScript.\n\nIf you already know something about usage of npm and npm packages, then you can\ndirectly see npm package manager section.\n\n\nnpm package type project#\n\nSo what is an npm package type project? When we execute the npm init command in\nan empty project directory, it creates a JSON file with the file name\npackage.json under the current directory. During the creation process, we will\nneed to fill in information including but not limited to the name, version\nnumber, description, etc. of the npm package, which will be found in the\nresulting package.json file as follows\n\n\n\nAt this point the project containing the initialized package.json file is an npm\npackage type project, and you can execute the npm publish command to publish the\nproject to the npm Registry.\n\nThe npm Registry is a npm package store where developers can not only publish\ntheir own npm packages to the npm Registry, but also use npm packages published\nby other developers through the npm Registry.\n\nA quality npm package will be used by more people because it not only saves a\nlot of code implementation work, but is also less likely to cause problems with\nthe project.\n\n\nUsing third-party npm packages#\n\nWhen adding a third-party npm package to an initial project, we can call this\nprocess \"installing dependencies for the project\" or \"adding dependencies to the\nproject\". Before adding dependencies, we need to know one thing in particular --\nthe types of packages npm depends on.\n\n * \"dependencies\": a type of package that your application will need in a\n production environment.\n * \"devDependencies\": another type of package that is only needed for local\n development and testing.\n \n > packages can be understood as third-party npm packages.\n\nYou can install the packages you need in a production environment by running npm\ninstall npm-package-name or npm add npm-package-name, or you can manually write\nthe packages you need to install and the corresponding semantic version in\n\"dependencies\" in the package.json file, and run the npm install command to.\n\n\n\nSimilarly, you can install only packages needed for local development and\ntesting by running npm install npm-package-name --save-dev or npm add\nnpm-package-name --save-dev, or you can manually write the packages to be\ninstalled and the corresponding semantic version in \"devDependencies\" in the\npackage.json file, and run the npm install command as follows\n\n\n\nWhen installing or using third-party npm packages be sure to determine what they\nare for and whether they should be placed in \"dependencies\" or \"devDependencies\"\nby distinguishing between their types.\n\nTIP\n\nIn general, packages that need to be used in source code are dependencies\ndependencies. Unless you are exporting dependent code locally via packaging, in\nwhich case it can be treated as a devDependencies dependency.\n\n\nOther npm bits and pieces to know#\n\n\nProgram entry for npm packages#\n\nThere is a \"main\" attribute in package.json that corresponds to a module ID or,\nmore intuitively, a NodeJS file path, which is the main entry point for your\napplication.\n\nFor example, if your package is named foo and the user installs it, and then\nexecutes the require(\"foo\") code, then the file corresponding to the \"main\"\nfield of the npm package foo will be exported.\n\nIt is recommended to set the \"main\" field in your npm package. If \"main\" is not\nset, the default entry will be the index.js file in the root of the package.\n\nIn addition to the \"main\" attribute, the \"module\" attribute is usually set. It\nis similar to the \"main\" attribute in that it is mainly used in webpack\nscenarios. webpack reads the npm package entry (file) in most cases in the order\n\"module\" -> \"main \".\n\n> To learn more about how webpack does this, check out this link.\n\n\nscripts#\n\nThe \"scripts\" attribute of the package.json file supports a number of built-in\nscripts and npm-preset lifecycle events, as well as arbitrary scripts.\n\nThese can be executed by running npm run-script or simply npm run .\n\nName matching pre and post commands will also be run (e.g. premyscript,\nmyscript, postmyscript ).\n\n\n\nWhen npm run myscripts is executed, the script corresponding to premyscripts\nwill be executed before it, and the script corresponding to postmyscripts will\nbe executed after it.\n\nScript commands from dependencies can be run with npm explore -- npm run .\n\nThere are also special lifecycle scripts that occur only under certain\ncircumstances. Here are a few that are usually necessary to know.\n\nnpm install#\n\nWhen you run npm install -g , the following scripts will run.\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\nIf your package root has a binding.gyp file and you don't define an install or\npreinstall script, then npm will build with node-gyp rebuild as the default\ninstall command, using node-gyp.\n\nnpm publish#\n\nWhen publishing a project, executing this command will trigger the following\nscript.\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\nWhen running in -dry-run mode, the script corresponding to prepare will not be\nexecuted.\n\n\npeerDependencies#\n\nIn some cases, your npm project has a compatibility relationship with its host\ntool or library (e.g. a webpack plugin project and webpack), and your npm\nproject does not want to use the host as a necessary dependency, which usually\nmeans that your project is probably a plugin for that host tool or library. Your\nnpm project will have certain requirements for the version of the host package,\nas only the APIs required by the npm project will be exposed under a specific\nversion.\n\nFor more explanation of peerDependencies, you can learn about the different ways\nnpm, pnpm, and Yarn handle it at the following links.\n\n * npm's explanation of peerDependencies\n * pnpm vs npm vs Yarn\n\n\nnpm package manager#\n\nIn addition to the standard package manager like npm, the mainstream ones are\npnpm and Yarn, both of which are good alternatives to npm cli.\n\nIt is recommended to use pnpm to manage project dependencies, which can be\ninstalled as follows.\n\n\n\n\nModern.js Module configuration file#\n\nThe Modern.js Module configuration file - modern.config.(j|t)s - is provided in\nthe project directory of the module project created with @modern-js/create.\nHowever, the modern.config configuration file is not required to exist.\n\nBy default, the contents of the generated configuration file are as follows.\n\n\n\nWe recommend using the defineConfig function, but it is not mandatory to use it.\nSo you can also return an object directly in the config file: the\n\n","routePath":"/module-tools/en/guide/basic/before-getting-started","lang":"en","toc":[{"text":"Environment preparation","id":"environment-preparation","depth":2,"charIndex":3},{"text":"Getting Started with npm","id":"getting-started-with-npm","depth":2,"charIndex":424},{"text":"npm package type project","id":"npm-package-type-project","depth":2,"charIndex":906},{"text":"Using third-party npm packages","id":"using-third-party-npm-packages","depth":2,"charIndex":1922},{"text":"Other npm bits and pieces to know","id":"other-npm-bits-and-pieces-to-know","depth":2,"charIndex":3606},{"text":"Program entry for npm packages","id":"program-entry-for-npm-packages","depth":3,"charIndex":3643},{"text":"`scripts`","id":"scripts","depth":3,"charIndex":-1},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":5883},{"text":"npm package manager","id":"npm-package-manager","depth":2,"charIndex":6585},{"text":"Modern.js Module configuration file","id":"modernjs-module-configuration-file","depth":2,"charIndex":6850}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":20,"title":"CLI Commands","content":"#\n\nCLI Commands available for Modern.js Module projects are as follows:\n\n\nmodern build#\n\n\n\nModern.js Module supports the platform build mode, which can be used to execute\nbuild tasks of other tools. Currently, the official support includes Rspress.\nFor example, you can start the doc build task to generate doc products by\nexecuting the modern build --platform commands.\n\n\nmodern new#\n\n\n\nThe modern new command is used to start the microgenerator functionality, which\nenables features for the project that are not provided by default.\n\nThe following features can currently be enabled.\n\n * Storybook V7\n * Tailwind CSS support\n * Modern.js Runtime API\n\nYou can learn more about these features in the Using the micro generator\nsection.\n\n\nmodern dev#\n\n\n\nThe Modern.js Module provides the ability to use debugging tools, which can be\nstarted with the modern dev command. Note, however, that no debugging-related\nplugins are provided by default, so executing modern dev will prompt: \"No dev\ntools found available \".\n\nThe officially supported debugging tool is Rspress, so you can run modern dev or\nmodern dev doc to execute it after you run modern new to enable it.\n\n\nmodern lint#\n\n\n\nRun ESLint to check the syntax of the code. Usually, we only need to check the\npart of the code that was changed in this commit with lint-staged during the\n-git commit phase.\n\n * The -no-fix argument turns off the ability to automatically fix lint error\n code.\n\n\nmodern change#\n\n\n\nThe modern change command is used to generate the required Markdown file for\nchangesets.\n\n\nmodern pre#\n\n\n\nYou can use the modern pre command to pre-release a version before the official\nrelease.\n\n\nmodern bump#\n\n\n\nModify the version number in package.json according to the Markdown file of the\nchangelog generated by changesets, and generate the CHANGELOG.md file.\n\n\nmodern release#\n\n\n\nThe -modern release command releases the module to the npm Registry.\n\n * The -tag argument specifies the specific dist tags to be used for the\n release.\n\n\nmodern gen-release-note#\n\n\n\nAutomatically generate Release Note based on the changeset information of the\ncurrent repository.\n\nTIP\n\nneeds to be executed before the bump command.\n\n\nmodern upgrade#\n\n\n\nThe modern upgrade command is used to upgrade the project Modern.js related\ndependencies to the latest version.\n\nExecuting the command npx modern upgrade in the project root directory will\nupdate the Modern.js dependencies in package.json of the currently executing\nproject to the latest version by default.","routePath":"/module-tools/en/guide/basic/command-preview","lang":"en","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":21,"title":"Modify the output","content":"#\n\n\nDefault output artifacts#\n\nWhen you use the modern build command in an initialized project, Modern.js\nModule will generate corresponding build artifacts based on the current\nconfiguration.\n\nThe default configuration is as follows:\n\n\n\nThe default output files has the following characteristics.\n\n * will generate CommonJS and ESM.\n * The code syntax is supported up to ES6 , and more advanced syntax will be\n converted.\n * All code is bundled into one file, i.e. bundle processing is performed.\n * The output root directory is the dist directory under the project, and the\n type file output directory is dist/types.\n\nYou may have the following questions when you see this.\n\n 1. what is buildPreset?\n 2. what determines these characteristics of the product?\n\nThen the next step is to first explain buildPreset.\n\n\nbuildPreset#\n\nThe buildPreset represents a prepared set or sets of build-related\nconfigurations that can be used to eliminate the trouble and complexity of\nconfiguration by using the default values corresponding to the build Preset,\nresulting in the expected product.\n\nModern.js Module mainly comes with two built-in build presets, including:\n\n * npm-component: Used to build component libraries.\n * npm-library: Used to package projects of other library types, such as tool\n libraries.\n\nIt also provides some variations, such as npm-library-with-umd and\nnpm-library-es5, which, as their names suggest, correspond to library presets\nwith umd output and support for es5 syntax, respectively. For more detailed\nconfiguration, you can refer to its API.\n\nIn addition, we can also fully customize the build configuration:\n\n\nbuildConfig#\n\nbuildConfig is a configuration option that describes how to compile and generate\nbuild artifacts. What was mentioned at the beginning about \"features of build\nartifacts\" are actually properties supported by buildConfig. The currently\nsupported properties cover the needs of most module type projects when building\nartifacts. buildConfig not only contains some properties that artifacts have,\nbut also contains some features needed to build artifacts. The following is a\nbrief list from a classification point of view.\n\nThe basic attributes of a build artifacts include:\n\n * Whether the artifact is bundled or not: the corresponding API is\n buildConfig.buildType.\n * Product support for syntax: the corresponding API is buildConfig.target.\n * Output format: the corresponding API is buildConfig.format.\n * How the output type file is handled: the corresponding API is\n buildConfig.dts.\n * How the sourceMap of the artifact is handled: the corresponding API is\n buildConfig.sourceMap.\n * The input (or source file) corresponding to the output: the corresponding API\n is buildConfig.input.\n * The directory of the output of the artifact: the corresponding API is\n buildConfig.outDir.\n * Build source directory: the corresponding API is buildConfig.sourceDir.\n\nCommon functions required for build artifacts include:\n\n * Alias: The corresponding API is buildConfig.alias.\n * Static resource handling: the corresponding API is buildConfig.asset.\n * Third-party dependency handling: The corresponding APIs are\n * buildConfig.autoExternal.\n * buildConfig.externals.\n * Copy: The corresponding API is buildConfig.copy.\n * Global variable substitution: the corresponding API is buildConfig.define.\n * Specify JSX compilation method, the corresponding API is\n [buildConfig.jsx](/api/config/ build-config#jsx).\n\nSome advanced properties or less frequently used functions:\n\n * Product code compression: The corresponding API is buildConfig.minify.\n * Code splitting: buildConfig.splitting\n * Specify whether the build artifacts is for the NodeJS environment or the\n browser environment: the corresponding API is buildConfig.platform.\n * umd product-related.\n * Specifies the global variables imported externally to the umd product: the\n corresponding API is buildConfig.umdGlobals.\n * Specify the module name of the umd product: the corresponding API is\n buildConfig.umdModuleName.\n\nIn addition to the above categories, frequently asked questions and best\npractices about these APIs can be found at the following links\n\n * About bundle and bundleless?\n * About input and sourceDir\n * About d.ts.\n * How to use define\n * How to handle third-party dependencies?\n * How to use copy?\n * How to use umd\n * How to use asset\n\n\nCombining Configuration and Presets#\n\nOnce we understand buildPreset and buildConfig, we can use them together.\n\nIn a real project, we can use buildPreset to quickly get a set of default build\nconfigurations. If you need to customise it, you can use buildConfig to override\nand extend it.\n\nThe extension logic is as follows.\n\n * When buildConfig is an array, new configuration items are added to the\n original preset.\n\n\n\nThis will generate an additional IIFE-formatted product that supports up to\nES2020 syntax on top of the original preset, in the dist/global directory under\nthe project.\n\n * When buildConfig is an object, the configuration items in the object are\n overwritten in the preset.\n\n\n\nThis will cause a sourceMap file to be generated for each build task.","routePath":"/module-tools/en/guide/basic/modify-output-product","lang":"en","toc":[{"text":"Default output artifacts","id":"default-output-artifacts","depth":2,"charIndex":3},{"text":"buildPreset","id":"buildpreset","depth":2,"charIndex":818},{"text":"buildConfig","id":"buildconfig","depth":2,"charIndex":1639},{"text":"Combining Configuration and Presets","id":"combining-configuration-and-presets","depth":2,"charIndex":4390}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":22,"title":"Versioning and Publishing","content":"#\n\nAn npm-type module project release process consists of two phases.\n\n * The first phase is during development, where the developer needs to provide a\n change file to record changes that need to be released.\n * The second phase is during release, collect all the change files to update\n the version, update the release log, and release new packages to the npm\n Registry.\n\nModern.js Module provides a set of version management and release solutions,\nwhich are suitable for single-package scenarios. For npm packages in monorepo,\nyou need to follow the strategies provided by various monorepo solutions.\n\n\nTracking changes#\n\nChanges need to be logged when they happen to the project. Changes that occur in\na project are typically.\n\n * New features\n * Fixes to issues\n * Configuration file changes\n * ...\n\nOnce these changes have been made, the current changes need to be documented\nwith the following command.\n\n * modern change\n\nExecuting the modern change command asks the developer several questions and\ngenerates a change log based on the developer's answers. The changelog file\ncontains the type of change and its description, and is committed to the git\nrepository.\n\n\n\nWhen executed successfully, the resulting Markdown file containing the change\nlog is saved in the project's .changeset directory. The contents will look like\nthe following.\n\n\n\n\nVersion update#\n\nWhen the project version needs to be updated, execute the following command.\n\n * modern bump\n\nExecuting modern bump will modify the version number in package.json based on\nthe contents of the Markdown file in the .changeset/ directory where the changes\nwere recorded, and generate the CHANGELOG.md file. These Markdown files are also\ndeleted when the version update is complete, so they are \"consumed \".\n\n\n\n\nPublish#\n\nTo publish a project, you can execute the following command.\n\n * modern publish\n\nThe modern release command publishes the project to the npm Registry.\n\nThe release is the latest version, which is also the official version. If you\nwant to change the dist-tag, you can specify it with the modern release --tag\ncommand. For example.\n\n\n\nHowever, if you want to change the version number of the current project to a\npre-release as well, you need to use the modern pre command.\n\n> dist-tag can be understood as: tagging the current release. Generally\n> speaking, the dist-tag for the default release is latest, so you can consider\n> latest as the dist-tag for the official release.\n\n\nPre-releases#\n\nWhen a pre-release is needed before the official release, the following command\nis executed.\n\n * modern pre\n\nFirst modern pre enter to enter pre-release mode, can be the same as the tag\nspecified with the modern release --tag command when releasing the project.\n\n\n\nThen you can update the specific version number with the modern bump command,\nwhich doesn't actually \"consume\" the Markdown file that records the changes:\n\n\n\nThen you can see that the updated version number in package.json will look like\nthis: 0.1.2-next.0.\n\nFinally, if you don't need to do a pre-release anymore, be sure to run the\nmodern pre exit command to exit the pre-release state and to release the\nofficial version when you run the modern bump command again.","routePath":"/module-tools/en/guide/basic/publish-your-project","lang":"en","toc":[{"text":"Tracking changes","id":"tracking-changes","depth":2,"charIndex":610},{"text":"Version update","id":"version-update","depth":2,"charIndex":1355},{"text":"Publish","id":"publish","depth":2,"charIndex":1780},{"text":"Pre-releases","id":"pre-releases","depth":2,"charIndex":2468}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":23,"title":"Using the Microgenerator","content":"#\n\nModern.js Module provides the Microgenerator tool, which allows for the current\nproject to.\n\n * add new directories and files\n * Modify the contents of the package.json file\n * Execute commands\n\nThus with these capabilities, Microgenerator can enable additional feature\nfunctionality for the project.\n\nThe microgenerator can be started via modern new. The current Microgenerator\nfeatures supported by the Modern.js Module are:\n\n\nDevelop Module Doc#\n\nWhen we want to write documentation for out module project, we can enable the\nmodule doc feature. will create docs directory and related files in the project\ndirectory, and add \"@modern-js/plugin-rspress\" dependency in package.json. Use\nmodern dev and modern build --platform to debug and build your doc site.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n\n\n\nStorybook#\n\nThe Storybook feature can be enabled when we want to debug a component or a\ncommon module. When this feature is enabled, the stories directory and\n.storybook directory are created in the project directory, and a new\n\"@modern-js/storybook\" dependency is added to package.json. Use storybook dev\nand storybook build to debug and build.\n\n\nTailwind CSS Support#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nIf you want to use Tailwind CSS for a project, you can refer to \"Using Tailwind\nCSS\".\n\n\nModern.js Runtime API#\n\nModern.js provides Runtime API capabilities that can only be used in the\nModern.js application project environment. If you need to develop a component\nfor use in a Modern.js application environment, then you can turn on this\nfeature and the microgenerator will add the \"@modern-js/runtime\" dependency.\n\nAlso, the Storybook debugging tool will determine if the project needs to use\nthe Runtime API by checking the project's dependencies and providing the same\nRuntime API runtime environment as the Modern.js application project.\n\nTIP\n\nAfter successfully enabling it, you will be prompted to manually add a code\nsimilar to the one below to the configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-micro-generator","lang":"en","toc":[{"text":"Develop Module Doc","id":"develop-module-doc","depth":2,"charIndex":431},{"text":"Storybook","id":"storybook","depth":2,"charIndex":895},{"text":"Tailwind CSS Support","id":"tailwind-css-support","depth":2,"charIndex":1243},{"text":"Modern.js Runtime API","id":"modernjs-runtime-api","depth":2,"charIndex":1528}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":24,"title":"Developing Module documentation","content":"#\n\nThis chapter describes how to quickly build a static documentation site for a\nmodule project.\n\n\nBefore we start#\n\n\nWhy we need to build a documentation site for a module#\n\n 1. a documentation site can help us to better organize the structure of the\n documentation.\n 2. the documentation site has better presentation, such as the ability to\n execute functions in the page, render components.\n 3. to make better use of AI search capabilities.\n\n\nPreliminary preparation#\n\n 1. Enable the documentation feature via micro-generator.\n 2. Read Introduction to Rspress.\n\nAfter finishing the preparation work, we will build a documentation site for the\nmodule project based on Rspress.\n\n\nBasic site structure#\n\nThe overall layout of the site consists of three parts: the navigation bar, the\nsidebar and the body part, which also includes the TOC (Table of contents found\nat the beginning of a book or document).\n\nThe Rspress uses File System Routing, on which the module documentation is\nbased, to automate the generation of the sidebar. For example, if you have the\nfollowing file structure:\n\n\n\nThen the routing path for foo/bar.md will be /foo/bar, the routing path for\nfoo.md will be /foo, and the routing path for index.md will be /.\n\nThe specific mapping rules are as follows:\n\nFILE-PATH ROUTING-PATH\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\nThe sidebars corresponding in turn to the above file paths and routing paths are\nshown below:\n\n\nConfigure sidebar#\n\nAs shown in the figure above, the module documentation has automatically\ngenerated sidebars for file system routing, where the text of each column of the\nsidebar is determined by the file's first level title or directory name. If you\nneed to customize the sidebar, please use _meta.json or configure sidebar\ndirectly.\n\nINFO\n\nIf your document directory structure complies with internationalization, for\nexample:\n\n\n\nYou need to follow internationalization guide and configure lang 和 locales,\notherwise, the automatically generated sidebar of the module will not handle the\nzh and en directories.\n\n\nWriting Documentation#\n\nNext, we can focus on writing the content of the document. In addition to the\nbasic Markdown syntax, you may also need to understand the following advanced\ntopics:\n\n * Using MDX\n * Using Assets\n\n\nComponent preview#\n\nModule documentation provides preview capabilities for component libraries. The\ncontents in code blocks written in jsx and tsx will be parsed as React\ncomponents.\n\n\nExample#\n\nHere is a complete example using the component preview feature:\n\nAssuming our project name is demo and we export a Button component.\n\n 1. Add a new docs/Button.mdx file:\n\n\n\n 2. In the tsconfig.json, configure aliases and point the package name to the\n current project directory, make the way document developers and users use\n components consistent:\n\n\n\n 3. In the .gitignore, add doc_build/:\n\n\n\nCongratulations, you have finished writing a component document, execute pnpm\nrun dev to see the result, remember to build the component library first to make\nsure the component product exists.\n\n\nMobile Preview#\n\nAlso, we support mobile preview mode, i.e. rendering mobile components using\niframe, and set iframe position by iframePosition, support swipe preview and new\npage opening.\n\n\n\nTIP\n\nIf you only want to change the way a particular jsx and tsx block is previewed,\nyou can use a different modifier to identify it:\n\n\n\n\nUsing external demos#\n\nIf our demo is very complex, then it is recommended to write the demo separately\nand then use the code tag in the mdx:\n\n\n\nThis also supports setting the preview method for each individual code block,\nfor example:\n\n\n\n\nUsing built-in components#\n\nThe plugin implements some built-in components internally so that you can\ndevelop module documentation more easily.\n\n\nAPI#\n\nDisplay the API content of the module.\n\nParse file#\n\nBefore we can use the API component, we first need to specify the files to\nparse:\n\n\n\nContent generation#\n\nNext, we'll see what kind of markdown content is generated based on the parsed\nfile.\n\nContent can be generated with two different tools, react-docgen-typescript or\ndocumentation:\n\n * react-docgen-typescript is targeted at component library scenarios and will\n only parse props to generate tables.\n\n\n\nThe above is a standard writeup where ButtonProps will be extracted into the\ntable and Button will be the title of the table. If you use the default export,\nthe filename will be used as the form title.\n\nNotice that export features declared elsewhere are not available.\n\n\n\nThe generated content is as follows:\n\n\n\nWARNING\n\nIf React types are used in Props, you need to add the types in tsconfig.json,\notherwise the types will not be resolved under the React namespace.\n\n\n\nThe best way is that you import the type directly:\n\n\n\n * documentation is used in tool library scenarios to parse JSDoc annotations.\n\n\n\nThe above is a greet function with a JSDoc annotation. The generated content is\nas follows:\n\n\n\nUsing the component#\n\nNext, you can use our built-in API components in your documentation by passing\nthe key value into the moduleName property。\n\n\n\n\nOverview#\n\nDisplays a list of modules that can be placed on the front page to display all\nmodules.\n\nThe Overview component has only one list property, which receives an array of\nobjects, and the following properties of the objects\n\nPROPERTY DESCRIPTION TYPE DEFAULT\nicon icon React.ReactNode \ntext text(required) string \nlink link(required) string \narrow whether to show arrows boolean false\n\n\nPlugin options#\n\n\napiParseTool#\n\nAPI parse tool.\n\n * Type:'react-docgen-typescript' | 'documentation'\n * Default: 'react-docgen-typescript'\n\n\ndoc#\n\nConfig.\n\n\nentries#\n\nModule names and relative paths for automatically generated documents.\n\n * Type:Entries | ToolEntries\n * Default: {}\n\n\n\nIt also supports the use of different parsing tools for different files:\n\n\n\n\niframePosition#\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nWhen the value is follow, each code block will have an iframe showing its\nrendered view. When fixed, the iframe will be fixed to the right side of the\npage, showing the view of all the code blocks on the current page.\n\n\nparseToolOptions#\n\nAPI parse tool options.\n\n * Type:ParseToolOptions\n * Default: {}\n\n\n\n\npreviewMode#\n\n * Type:'iframe' | 'internal'\n * Default: 'internal'\n\nIn case of internal, the component will be rendered directly in the page,\notherwise it will be loaded through an iframe.\n\n\ndeprecated: languages#\n\nWARNING\n\nStarting from version 2.44.0, please refer to the Internationalization section\nto implement multiple languages.\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\nStarting from version 2.44.0, a sniffing mechanism has been implemented\ninternally, so please directly use _meta.json or directly configure sidebar to\nimplement a custom sidebar.\n\n\nScripts#\n\n * modern dev: Start dev server for doc site.\n * modern build --platform: Build doc site in production, by default output\n directories is doc_build.\n\n\nAdvanced guide#\n\nThe above has covered the basics of developing module documentation, but this is\nnot enough for developing a complete documentation station. Check out the\nRspress for an in-depth look at our documentation framework. You can modify the\ndocumentation framework configuration via the doc configuration.\n\n","routePath":"/module-tools/en/guide/basic/use-module-doc","lang":"en","toc":[{"text":"Before we start","id":"before-we-start","depth":2,"charIndex":98},{"text":"Why we need to build a documentation site for a module","id":"why-we-need-to-build-a-documentation-site-for-a-module","depth":3,"charIndex":117},{"text":"Preliminary preparation","id":"preliminary-preparation","depth":3,"charIndex":451},{"text":"Basic site structure","id":"basic-site-structure","depth":2,"charIndex":686},{"text":"Configure sidebar","id":"configure-sidebar","depth":3,"charIndex":1493},{"text":"Writing Documentation","id":"writing-documentation","depth":2,"charIndex":2109},{"text":"Component preview","id":"component-preview","depth":2,"charIndex":2329},{"text":"Example","id":"example","depth":3,"charIndex":2514},{"text":"Mobile Preview","id":"mobile-preview","depth":3,"charIndex":3121},{"text":"Using external demos","id":"using-external-demos","depth":3,"charIndex":3451},{"text":"Using built-in components","id":"using-built-in-components","depth":2,"charIndex":3691},{"text":"API","id":"api","depth":3,"charIndex":3837},{"text":"Parse file","id":"parse-file","depth":4,"charIndex":3883},{"text":"Content generation","id":"content-generation","depth":4,"charIndex":3981},{"text":"Using the component","id":"using-the-component","depth":4,"charIndex":5005},{"text":"Overview","id":"overview","depth":3,"charIndex":5154},{"text":"Plugin options","id":"plugin-options","depth":2,"charIndex":5675},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":5693},{"text":"doc","id":"doc","depth":3,"charIndex":5817},{"text":"entries","id":"entries","depth":3,"charIndex":5833},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":6040},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":6320},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":6408},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":6599},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":6746},{"text":"Scripts","id":"scripts","depth":2,"charIndex":6967},{"text":"Advanced guide","id":"advanced-guide","depth":2,"charIndex":7130}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":25,"title":"Using Storybook","content":"#\n\nStorybook is a tool dedicated to component debugging, providing around component\ndevelopment.\n\n * Develop UIs that are more durable\n * Test UIs with less effort and no flakes\n * Document UI for your team to reuse\n * Share how the UI actually works\n * Automate UI workflows\n\nBefore when using Storybook, there are various problems related to\nconfigurations, Babel, Webpack, less or sass. Modern.js integrates with\nStorybook, which greatly simplifies configuration for us as we develop our\nStorybook project.\n\n\nV7 (Recommended)#\n\n\nEnable Storybook#\n\nYou can directly enable the Storybook feature by using the following command:\n\n\n\nThis command will create a template for Storybook, including:\n\n * Creating a configuration folder .storybook and a default configuration file\n .storybook/main.ts.\n * Creating example story components.\n * Updating package.json to add dependencies @storybook/addon-essentials and\n @modern-js/storybook, as well as creating Storybook-related scripts.\n\n\nEnable Debug output#\n\nIn fact, Modern.js Module is implemented based on esbuild, while Storybook uses\nWebpack as the default build tool, and their configurations are not fully\ncompatible. Therefore, we recommend building the components first, and then\nimporting the component output in stories.\n\nThe way to import component outputs is very simple. Suppose your module exports\na Button component, then you can use it in stories like this:\n\n\n\nIf you want to update the components, you can start the build in watch mode\nbefore starting Storybook:\n\n\n\nINFO\n\nIn the development process, you may encounter situations where you cannot get\ntype definitions in real time. Because only when the code is saved, the type\nfile under the output directory will be updated. At this time:\n\nFor pnpm projects, you can modify the package.json as follows:\n\n\n\n> For the use of publishConfig in pnpm, you can read the following link.\n\nFor npm and Yarn projects, the types value of package.json can only be modified\nmanually during the development stage and release stage.\n\n\nEnable Rspack build#\n\nRspack is known for its fast build speed. To use Rspack as a build tool in\nModern.js, you only need to configure it as follows:\n\n\n\nNote that in the above configuration, the reactDocgen configuration has been\nchanged because Rspack currently does not support\n@storybook/react-docgen-typescript-plugin.\n\n\nConfigurations#\n\nThere are some separate configurations in .storybook/main.js.\n\nbundler#\n\n * Type: 'webpack' | 'rspack'\n * Default: webpack\n\nSpecify the underlying bundler to use either Webpack or Rspack.\n\nExample:\n\n\n\nbuilderConfig#\n\n * Type: BuilderConfig\n * Default: undefined\n\nThe Storybook build capability of Modern.js is provided by Rsbuild, and the\nRsbuild configuration can be modified through builderConfig.\n\n\n\n\nCommand#\n\n@modern-js/storybook proxies some storybook cli commands\n\nstorybook dev#\n\nStart Storybook,detail\n\nstorybook build#\n\nBuild Storybook for production,detail\n\n\nMigrate from V6 to V7#\n\nOur support methods for the two versions are different, so if you are migrating\nfrom V6 to V7, we hope you will also use V7 in the same way, while making the\nfollowing adjustments:\n\n * Configuration file: Migrate any custom configurations (if any) in the\n original root/config/storybook/main.(j|t)s to the new\n root/.storybook/main.(j|t)s.\n * Dependencies: Upgrade @storybook/addon-* series dependencies (if any) to\n version 7 and delete @modern-js/plugin-storybook dependencies.\n * Commands: Delete the original edenx dev storybook and edenx build --platform\n commands. If you are used to the original pnpm run dev usage, you can replace\n it with storybook dev -p 6006 and storybook build.\n * modern.config.(j|t)s : Remove the registration of @modern-js/plugin-storybook\n plugin.\n\n\nV6 (legacy)#\n\nStarting from 2.40.0 version, @modern-js/plugin-storybook will stop iterating.\nIt is recommended to use the V7 version. If your @modern-js/module-tools version\nis lower than 2.40.0, you can use Storybook V6 in the following ways:\n\n\nStart Storybook#\n\nYou can directly use the following command to enable the Storybook feature.\n\n\n\nThis command will create commonly used templates for Storybook, including\n\n * Create stories component examples\n * Update package.json, add a dependency on @modern-js/plugin-storybook, and add\n related scripts such as pnpm dev storybook.\n\n\nConfigure Storybook#\n\nThe Storybook official configures the project through a folder named .storybook,\nwhich contains various configuration files. In Modern.js Module, you can add\nStorybook configuration files in the project's config/storybook directory.\n\nFor how to use various Storybook configuration files, you can check the\nfollowing link:\n\n * Configure Storybook\n\nHowever, there are some restrictions when using it in module projects:\n\n * Cannot change the location where Story files are stored, that is, the stories\n configuration cannot be modified in the main.js file.\n * Cannot modify the configuration related to Webpack and Babel, that is, the\n webpackFinal and babel configurations cannot be modified in the main.js file.\n\n\nBuild Storybook Output#\n\nIn addition to debugging the component or ordinary modules with Storybook, you\ncan also use the following command to execute the Storybook build task.\n\n\n\nAfter the build is complete, you can see the build output files in the\ndist/storybook-static directory.","routePath":"/module-tools/en/guide/basic/using-storybook","lang":"en","toc":[{"text":"V7 (Recommended)","id":"v7-recommended","depth":2,"charIndex":511},{"text":"Enable Storybook","id":"enable-storybook","depth":3,"charIndex":531},{"text":"Enable Debug output","id":"enable-debug-output","depth":3,"charIndex":985},{"text":"Enable Rspack build","id":"enable-rspack-build","depth":3,"charIndex":2036},{"text":"Configurations","id":"configurations","depth":3,"charIndex":2361},{"text":"bundler","id":"bundler","depth":4,"charIndex":2441},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":2579},{"text":"Command","id":"command","depth":3,"charIndex":2782},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":2850},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":2890},{"text":"Migrate from V6 to V7","id":"migrate-from-v6-to-v7","depth":2,"charIndex":2948},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":3767},{"text":"Start Storybook","id":"start-storybook","depth":3,"charIndex":4013},{"text":"Configure Storybook","id":"configure-storybook","depth":3,"charIndex":4352},{"text":"Build Storybook Output","id":"build-storybook-output","depth":3,"charIndex":5092}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":26,"title":"Developing Components","content":"#\n\nThis chapter will describe how to develop component projects using the Modern.js\nModule.\n\n\nInitialize the project#\n\n 1. It is recommended to use the @modern-js/create command to initialize an npm\n project.\n\n\n\n 2. The initialized directory structure:\n\n\n\n 3. Finally, modify the file suffix and content of ./src/index.ts as follows,\n and the initialization of the component project is completed.\n\n\n\n\nDebugging code with Storybook#\n\nPlease refer to \"Using Storybook\" to debug code using Storybook.\n\n\nDeveloping Styles#\n\nNext we can add styles to the component.\n\nThe following capabilities are currently supported for developing styles.\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module supports PostCSS and has the following built-in PostCSS\nplugins.\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\nSo we can create .css files in our projects and use the syntax support and\ncapabilities provided by these plugins directly in our css files.\n\n * Source Code:\n\n\n\n * CSS artifact:\n\n\n\n\nLess#\n\nModern.js Module supports development styles using Less.\n\n> The current built-in Less version is v4.1.3\n\n * Source Code:\n\n\n\n * Less artifact:\n\n\n\n\nSass/Scss#\n\nModern.js Module supports developing styles using Scss/Sass.\n\n> The current built-in Sass version is v1.54.4\n\n * Source code:\n\n\n\n * Less artifact:\n\n\n\n\nTailwind CSS#\n\nPlease refer to \"Using Tailwind CSS\" for detailed usage.\n\n\nCSS Modules#\n\nModern.js Module supports the development of styles using CSS Modules. By\ndefault, the following files are recognized as CSS Module files.\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\nIf you need to configure CSS Modules, you can check out the API at\n\n * style.autoModules\n * style.modules\n\nThe following is a code example.\n\n\n\n\n\n\nConfiguring build artifacts#\n\nBased on most scenarios of component project usage, it is recommended to use the\nnpm-component build preset. This preset yields a output directory structure of\n\n\n\n * . /dist/es: Contains bundleless artifacts in ES modules format that support\n the es6 syntax.\n * . /dist/lib: Contains bundleless artifacts in CommonJS format with support\n for es6 syntax.\n * . /dist/types: Contains the types file.\n\nThe buildPreset can be configured manually if there is a requirement to use\nsyntax support, and supports modifying the supported syntax by adding a suffix\nto npm-component.\n\n\n\nIf you have special needs for the build artifacts directory structure, you can\nuse the buildConfig API, which can be used by the following documentation.\n\n * modify-output-product\n * in-depth-about-build\n\n\nReleasing components#\n\nIt is recommended to use the version release feature provided by Modern.js\nModule. You can refer to the \"Version Management and Release\" section for more\ninformation.","routePath":"/module-tools/en/guide/best-practices/components","lang":"en","toc":[{"text":"Initialize the project","id":"initialize-the-project","depth":2,"charIndex":93},{"text":"Debugging code with Storybook","id":"debugging-code-with-storybook","depth":2,"charIndex":406},{"text":"Developing Styles","id":"developing-styles","depth":2,"charIndex":505},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":711},{"text":"Less","id":"less","depth":3,"charIndex":1098},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":1251},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":1414},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":1488},{"text":"Configuring build artifacts","id":"configuring-build-artifacts","depth":2,"charIndex":1852},{"text":"Releasing components","id":"releasing-components","depth":2,"charIndex":2666}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":27,"title":"Using Tailwind CSS","content":"#\n\nTailwind CSS is a CSS framework and design system based on Utility Class, which\ncan quickly add common styles to components, and support flexible extension of\ntheme styles.\n\nModern.js Module supports developing component styles using Tailwind CSS.\n\n\nEnabling Tailwind CSS#\n\nTo use Tailwind CSS in Modern.js Module, you can follow the steps below:\n\n 1. Run pnpm run new in the root directory of your project and make the\n following selections:\n\n\n\nAfter successful initialization, you will see that the package.json has added\ndependencies for tailwindcss and @modern-js/plugin-tailwindcss.\n\n 2. Register the Tailwind plugin in modern.config.ts:\n\n\n\n 3. Create a index.css file and add the following code:\n\n\n\nINFO\n\nDepending on your needs, you can selectively import the CSS styles provided by\nTailwind CSS. Please refer to the @tailwind documentation for detailed usage of\nthe @tailwind directive.\n\n 4. Import the index.css file, for example, add the following code in the root\n component src/index.jsx:\n\n\n\n 5. Now you can use the Utility Classes provided by Tailwind CSS in your\n components:\n\n\n\n\nConfiguring Tailwind CSS#\n\nIn Modern.js Module, you have two ways to configure Tailwind CSS:\n\n 1. Using the tailwind.config.{ts,js} file, which follows the official usage of\n Tailwind CSS. Please refer to \"Tailwind CSS - Configuration\" for more\n details.\n\n\n\nTIP\n\nPlease upgrade Modern.js to version >= 2.33.0 to support automatic reading of\ntailwind.config.{ts,js} files.\n\n 2. Using the style.tailwindcss configuration option. This is the old way of\n configuring Tailwind CSS, and we recommend using the tailwind.config.{ts,js}\n file for configuration.\n\n\n\nIf you are using both the tailwind.config.{ts,js} file and style.tailwindcss\noption, the configuration defined in style.tailwindcss will take precedence and\noverride the content defined in tailwind.config.{ts,js}.\n\n\nTailwind CSS Autocomplete#\n\nTailwind CSS provides an official extension called Tailwind CSS IntelliSense for\nautocompletion of Tailwind CSS class names, CSS functions, and directives in VS\nCode.\n\nYou can follow the steps below to enable the autocomplete feature:\n\n 1. Install the Tailwind CSS IntelliSense extension in VS Code.\n 2. If the root directory of your project does not have a\n tailwind.config.{ts,js} file, you need to create one and write the Tailwind\n CSS configuration for your current project. Otherwise, the IDE plugin will\n not work correctly.\n\n\nBuild Modes#\n\nWhen using Tailwind CSS, please note that there are significant differences\nbetween the bundle and bundleless modes in terms of the build artifacts.\n\nTIP\n\nFor definitions of bundle and bundleless, please refer to the \"In-depth\nunderstanding of build\".\n\n\nBundle Mode#\n\nIn Bundle mode, a separate CSS file is generated, and the JS output does not\nautomatically reference the CSS output file.\n\n * Source code:\n\n\n\n * Output code:\n\n\n\n\n\nIf you need to inject styles into the JS artifact, you can enable the\nstyle.inject option.\n\nIf you haven't enabled style.inject, you can also let users manually import the\nCSS file:\n\n\n\n\nBundleless Mode#\n\nIn bundleless mode, the CSS file is automatically imported in the artifact code\nwithout the need for additional processing.\n\n * Output code:\n\n\n\n\nClass Name Prefix#\n\nYou can add a class name prefix using the prefix option provided by Tailwind\nCSS. This helps avoid potential class name conflicts, such as when different\nversions of Tailwind CSS are used in different parts of an application or\nmodule.\n\nFor example, you can add the foo- prefix using the prefix option in\ntailwind.config.js:\n\n\n\n * Source Code:\n\n\n\n * Output Code:\n\n\n\n\nUsage Guide#\n\nHere are some usage examples of Tailwind CSS.\n\n\nHTML Class Names#\n\nTailwind CSS supports adding styles to HTML tags through class names. When using\nHTML class names, please note that the corresponding CSS styles of Tailwind CSS\nmust be imported in advance.\n\n\n\nGenerated styles (after bundling):\n\n\n\n\n@apply#\n\nTailwind CSS provides the @apply directive, which allows us to inline the styles\nprovided by Tailwind CSS into our own styles.\n\n@apply can be used in CSS, Less, and Sass.\n\n\n\nHowever, there are some considerations when using it with Less and Sass:\n\nSass#\n\nWhen using Tailwind with Sass and there is an !important after @apply,\ninterpolation should be used to ensure Sass compiles correctly.\n\n * Won't work as expected:\n\n\n\n * Will work as expected:\n\n\n\nLess#\n\nWhen using Tailwind with Less, you cannot nest Tailwind's @screen directive.\n\n * Won't work as expected:\n\n\n\n * Instead, use regular media queries and the theme() function to reference your\n screen sizes or simply avoid nesting your @screen directive.\n\n\n\n\n\n\nAbout designSystem config#\n\ndesignSystem is a deprecated configuration option in Modern.js Module.\n\nStarting from Modern.js Module version 2.33.0, you can use the theme\nconfiguration option of Tailwind CSS as a replacement for designSystem. It is no\nlonger necessary to split the theme configuration and set it on designSystem.\n\n * Previous usage:\n\n\n\n * Current usage:\n\n","routePath":"/module-tools/en/guide/best-practices/use-tailwindcss","lang":"en","toc":[{"text":"Enabling Tailwind CSS","id":"enabling-tailwind-css","depth":2,"charIndex":252},{"text":"Configuring Tailwind CSS","id":"configuring-tailwind-css","depth":2,"charIndex":1105},{"text":"Tailwind CSS Autocomplete","id":"tailwind-css-autocomplete","depth":3,"charIndex":1889},{"text":"Build Modes","id":"build-modes","depth":2,"charIndex":2460},{"text":"Bundle Mode","id":"bundle-mode","depth":3,"charIndex":2728},{"text":"Bundleless Mode","id":"bundleless-mode","depth":3,"charIndex":3091},{"text":"Class Name Prefix","id":"class-name-prefix","depth":2,"charIndex":3254},{"text":"Usage Guide","id":"usage-guide","depth":2,"charIndex":3641},{"text":"HTML Class Names","id":"html-class-names","depth":3,"charIndex":3703},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":4211},{"text":"Less","id":"less","depth":4,"charIndex":4413},{"text":"About `designSystem` config","id":"about-designsystem-config","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":28,"title":"General Questions","content":"#\n\n\nWhat is the relationship between Modern.js Module and Rsbuild?#\n\nModern.js Module uses esbuild to build toolkits and component libraries, and\nRsbuild focuses on solving web application building scenarios.\n\n\nCan Modern.js Module use webpack plugins or loaders?#\n\nModern.js Module is based on esbuild for building and cannot use tools from the\nwebpack-related ecosystem. You can find more community plugins for esbuild here\n\nIf the UMD product produced by Modern.js Module does not meet your requirements,\nyou can use Rsbuild and add UMD Plugin to build UMD products.","routePath":"/module-tools/en/guide/faq/basic","lang":"en","toc":[{"text":"What is the relationship between Modern.js Module and Rsbuild?","id":"what-is-the-relationship-between-modernjs-module-and-rsbuild","depth":2,"charIndex":3},{"text":"Can Modern.js Module use webpack plugins or loaders?","id":"can-modernjs-module-use-webpack-plugins-or-loaders","depth":2,"charIndex":210}],"domain":"","frontmatter":{},"version":""},{"id":29,"title":"Build FAQ","content":"#\n\nHere only some common problems and bad cases are recorded.\n\nIf the build products do not meet expectations, especially when buildPreset is\nconfigured, please first understand what configuration items buildPreset\nrepresents, and then check each configuration item based on all configuration\nitems.\n\n\nProduct FAQ#\n\n\nInitialization of Class Fields#\n\nTypeSript provides the useDefineForClassFields configuration to control the\nconversion handling for public class fields.\n\nIf we have a piece of code:\n\n\n\nWhen useDefineForClassFields is false, then the compiled code will look like:\n\n\n\nWhen useDefineForClassFields is true, then the compiled code will look like:\n\n\n\nAlso the default value of this configuration will change depending on the target\nconfiguration of tsconfig.json: When target is ES2022 or higher, then\nuseDefineForClassFields is configured to true by default, otherwise it defaults\nto false.\n\nFor more information on this configuration of TypeScript, you can refer to the\nfollowing link:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nThe Modern.js Module will currently process according to the following logic:\n\n 1. The first decision to enable this feature inside Modern.js Module is based\n on the useDefineForClassFields configuration in tsconfig.json of the current\n project. Currently, only the contents of the tsconfig.json file under the\n current project path will be read, and the final tsconfig configuration\n based on the extends configuration is not supported at this time.\n 2. If the useDefineForClassFields configuration of tsconfig.json is not\n detected, the default value is determined based on the target configuration\n of tsconfig.json. If target is greater than ES2022 (including EsNext), then\n useDefineForClassFields defaults to true, otherwise it is false.\n 3. If the target of tsconfig.json is not detected, it is processed according to\n the value of useDefineForClassFields as true.\n\n\nbabel-plugin-lodash treats the introduced lodash as undefined#\n\nThis problem occurs when using something like the following:\n\n\n\nCurrent related issues on the babel-plugin-lodash Github:\n\n * #235\n\nThe solution to this problem is to remove babel-plugin-lodash, since the plugin\nis not needed for on-demand referencing at this point and using it would have\nside effects.\n\nA similar situation occurs with babel-plugin-import. If there is code like the\nfollowing:\n\n\n\nIn this case babel-plugin-import may also cause Comps to become undefined. So\nyou need to remove the corresponding babel-plugin-import as well.\n\n\nCannot find module 'http'#\n\nIf the output reports an error like Cannot find module 'http' at browser\nruntime, it means that your output has bundled node modules. This may occur if\nsome of your dependencies support both browser and node, such as axios, in which\ncase you only need to set the platform to browser. If some third-party packages\ndon't support the browser, you may need to manually inject node polyfill.\n\n\nExceptions FAQ#\n\n\nDynamic require of \"react\" is not supported#\n\nProblem Description#\n\nWhen the product format in the product configuration of the build is ES modules.\n\n\n\nIf you import a cjs product from a third-party npm package, the resulting\nproduct may not work properly under webpack.\n\n\n\nSolution#\n\n 1. First you need to find which third-party package is causing the problem. For\n example, if the error message points to the react package, then look for a\n third-party package that has code like require('react') in it. For example\n react-draggable, which only contains cjs artifacts, then the problem is\n localized to the react-draggable package.\n 2. Then we need to exclude this package with the following configuration, i.e.\n not package problematic third-party packages.\n\n\n\nReference Links#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\nDuring compilation, an error was reported in the less file of a component\nlibrary:'Operation on an invalid type'#\n\nThis is probably because the component library depends on Less version v3, while\nModern.js Module defaults to v4. v3 and v4 have a Break Change in the math\nconfiguration, check this link for details.\n\nTherefore, if a component library like this is used in the source code:\n\nbuildPreset is used in the build configuration, make the following changes:\n\n\n\nOr, if a custom buildConfig is used, modify it as follows:\n\n\n\nIf you are using a component like this in Storybook, you will need to modify the\ndebugging configuration of Storybook:\n\n\n\n\nBundleless DTS failed#\n\nIn the bundleless scenario, it's tsc that generates the type declaration file\ndirectly. You can find the problem file by printing the error message in the\nterminal. For source code files, it is recommended to fix the type problem,\nwhich can better enable reuse of your package. However. if you encounter a type\nchecking problem with a thrid-party package:\n\n 1. enable skipLibCheck to skip the d.ts check of the thrid-party package.\n 2. If the package exports ts files directly, skipLibCheck will not work because\n it can only skip the d.ts check, so you can only turn off dts.abortOnError\n to ignore these errors.\n\n\nBundle DTS failed#\n\nThe Modern.js Module directly uses rollup-plugin-dts to package your type\ndescription files. It may not be able to handle the type files of some\nthird-party dependencies\n\nIf you encounter an error message titled \"Bundle DTS failed\" during the build\nprocess of the Modern.js Module, you can observe that the error message is from\na third-party dependency. Try setting dts.respectExternal to false to turn off\nthe behavior of packaging type files of third-party dependencies.\n\n\nError reported for defineConfig function type: If there is no reference to \"...\"\nthen the inferred type of \"default\" cannot be named#\n\nCheck if the include configuration exists in the project's tsconfig.json file,\nand if not, try adding the following:\n\n\n\n\nOther FAQ#\n\n\nHow to skip the pre-processing of less/scss files with bundleless#\n\nBundleless is a single-file compilation method. You just need to remove your\nless/scss files from the entry and copy them to the output. Note that we will\nalso rewrite the moduleId of js referencing less/scss, turn it off through the\nredirect plugin.\n\nBelow is an example of skipping less file processing. You will find that all\nless files in src are copied to dist and the relative path is preserved.\n\n\n\n\nAdd additional compilation feature#\n\nThe Modern.js Module is based on the esbuild implementation, so if you have\nspecial needs or want to add additional compilation capabilities, you can do so\nby implementing the esbuild plugin.\n\nThe Modern.js Module provides esbuildOptions configuration to allow modification\nof Modern.js's internal esbuild configuration, so that custom esbuild plugins\ncan be added via this configuration:\n\n\n\nWhen adding an esbuild plugin, please note that you need to add the plugin at\nthe beginning of the plugins array. This is because the Modern.js Module is also\nintegrated into the entire build process through an esbuild plugin. Therefore,\ncustom plugins need to be registered with higher priority.\n\n\nSupport for generating TypeScript declaration files for CSS Modules#\n\n * First Solution: typed-css-modules\n * Second Solution: postcss-modules-dts\n\n","routePath":"/module-tools/en/guide/faq/build","lang":"en","toc":[{"text":"Product FAQ","id":"product-faq","depth":2,"charIndex":301},{"text":"Initialization of Class Fields","id":"initialization-of-class-fields","depth":3,"charIndex":316},{"text":"babel-plugin-lodash treats the introduced lodash as `undefined`","id":"babel-plugin-lodash-treats-the-introduced-lodash-as-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":2578},{"text":"Exceptions FAQ","id":"exceptions-faq","depth":2,"charIndex":2995},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":3013},{"text":"Problem Description","id":"problem-description","depth":4,"charIndex":3059},{"text":"Solution","id":"solution","depth":4,"charIndex":3287},{"text":"Reference Links","id":"reference-links","depth":4,"charIndex":3792},{"text":"During compilation, an error was reported in the less file of a component library:`'Operation on an invalid type'`","id":"during-compilation-an-error-was-reported-in-the-less-file-of-a-component-libraryoperation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":4560},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":5206},{"text":"Error reported for `defineConfig` function type: `If there is no reference to \"...\" then the inferred type of \"default\" cannot be named`","id":"error-reported-for-defineconfig-function-type-if-there-is-no-reference-to--then-the-inferred-type-of-default-cannot-be-named","depth":3,"charIndex":-1},{"text":"Other FAQ","id":"other-faq","depth":2,"charIndex":5958},{"text":"How to skip the pre-processing of less/scss files with bundleless","id":"how-to-skip-the-pre-processing-of-lessscss-files-with-bundleless","depth":3,"charIndex":5971},{"text":"Add additional compilation feature","id":"add-additional-compilation-feature","depth":3,"charIndex":6445},{"text":"Support for generating TypeScript declaration files for CSS Modules","id":"support-for-generating-typescript-declaration-files-for-css-modules","depth":3,"charIndex":7173}],"domain":"","frontmatter":{},"version":""},{"id":30,"title":"FAQ","content":"#\n\nHere is a list of all frequently asked questions about Modern.js Module.\n\n * General FAQ\n * Build FAQ\n * Storybook FAQ","routePath":"/module-tools/en/guide/faq/","lang":"en","toc":[],"domain":"","frontmatter":{},"version":""},{"id":31,"title":"Storybook FAQ","content":"#\n\n\nStorybook v7 Support#\n\nStorybook v7 is now fully supported and has become our recommended version.\n\n\nUsing Storybook Addon or other configurations does not work#\n\nModern.js Module is currently using Storybook version v6, if you are using Addon\nversion v7 you may not be able to get the addon to work.\n\nIn addition to the Addon, other configurations may also have differences. For\nexample, if you modify the preview.js configuration file, Storybook v6 is\nwritten differently than v7:\n\n * v6:Document\n * v7:Document\n\n\nCannot find module 'react-dom/package.json'#\n\nWhen debug Storybook, the following problem occurs:\n\n\n\nYou can install the react-dom dependency in the project.\n\n\n\n\nUnable to locate the specific error message#\n\nSolutions:\n\n 1. Find @storybook/core-server/dist/cjs/dev-server.js\n 2. Find this code: var _await$Promise$all = await Promise.all([preview,\n manager,.\n 3. Modify it:\n\n\n\n\nCan`t find any stories is your Storybook#\n\n\n\nWhen you get a problem like this, you can first open the browser console and\nthere should be some error messages. You can use the error messages to deduce if\nthere is a problem in the code you are writing that is causing Storybook to not\nwork properly.\n\n\nStorybook Adds Proxy Functionality#\n\nStorybook does not provide a solution for this, but there is one in the\nStorybook Issue. In the Modern.js Module, you can:\n\n 1. Add the .storybook/middleware.js file and initialize the following:\n\n\n\n 2. add http-proxy-middleware dependency\n 3. Add proxy routing-related configuration\n\n\n\nLink:https://github.com/storybookjs/storybook/issues/11551\n\n\nTailwind CSS doesn't work in Storybook#\n\nThe Storybook build capability of the Modern.js Module is provided by Rsbuild.\nSince the underlying implementation of Rsbuild is not integrated with Modern.js\nModule, the Modern.js Module plugins do not work in Storybook (Rsbuild).\n\nSolution: Register the tailwindcss PostCSS plugin in storybook.\n\nReference link: Rsbuild - tailwindcss.","routePath":"/module-tools/en/guide/faq/storybook","lang":"en","toc":[{"text":"Storybook v7 Support","id":"storybook-v7-support","depth":2,"charIndex":3},{"text":"Using Storybook Addon or other configurations does not work","id":"using-storybook-addon-or-other-configurations-does-not-work","depth":2,"charIndex":104},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":519},{"text":"Unable to locate the specific error message","id":"unable-to-locate-the-specific-error-message","depth":2,"charIndex":681},{"text":"Can`t find any stories is your Storybook","id":"cant-find-any-stories-is-your-storybook","depth":2,"charIndex":900},{"text":"Storybook Adds Proxy Functionality","id":"storybook-adds-proxy-functionality","depth":2,"charIndex":1200},{"text":"Tailwind CSS doesn't work in Storybook","id":"tailwind-css-doesnt-work-in-storybook","depth":2,"charIndex":1585}],"domain":"","frontmatter":{},"version":""},{"id":32,"title":"Quick Start","content":"#\n\n\n3 minute demo#\n\nWant to experience Modern.js Module in action? The only prerequisite you need is\nNode.js LTS and make sure your Node version is >= 16.0.0.We recommend using the\nLTS version of Node.js 18.\n\n\nCreate new project#\n\nIf you want to create a complete Modern.js Module, you can execute the following\ncommand:\n\n\n\nINFO\n\nExecute npx @modern-js/create -h for more command line arguments\n\nNext, in the issue interaction, follow the options below.\n\n\n\n> The project name is the value of the \"name\" field in package.json.\n\nThen the process of initializing the project will start. After the project\ndirectory and files are generated and the dependencies are installed, a complete\nmodule project is created.\n\nWe can start the project build directly with the pnpm build command, and start\nthe build in watching mode with the pnpm build --watch command.\n\n\nAdd to an existing project#\n\nFrom your shell, install the following dependencies in your project.\n\n * @modern-js/module-tools\n * \"typescript\" (omitted if not a TypeScript project)\n\n> If it's a TypeScript project, add the \"typescript\" dependency.\n\n> For projects that use pnpm or the Yarn package manager, just replace npm. pnpm\n> is recommended.\n\nNext, create the modern.config.(t|j)s file in the root of the project.\n\n\n\nFinally, add the command \"build\": \"modern build\" to the project's package.json\nfile.\n\n\n\nIf your project has a src/index.(js|jsx) file or both src/index.(ts|tsx) and\ntsconfig.json files, then congratulations you can run the npm run build command\ndirectly to build your project with Modern.js Module.\n\n\nCore npm Package#\n\n@modern-js/module-tools is the core npm package of Modern.js Module, providing\nthe following capabilities:\n\n * It offers commonly used CLI commands such as modern dev, modern build, and\n more.\n * It integrates Modern.js Core, providing capabilities for configuration\n parsing, plugin loading, and more.\n * It integrates esbuild and SWC, providing build capabilities.\n * It integrates some commonly used plugins, such as plugin-lint,\n plugin-changeset, and others.\n\n@modern-js/module-tools is implemented based on the plugin system of Modern.js.\nEssentially, it is a plugin. Therefore, you need to register moduleTools in the\nplugins field of the configuration file:\n\n\n\n\nView official example#\n\nIf you want to see the complete project using the Modern.js Module, you can\nexecute the following command.\n\n\n\n\nLet's get started#\n\nChoose your tutorial scenario...\n\n * I'm a beginner and need to learn basic usage of Modern.js Module.\n * I have learned the basic usage of Modern.js Module and can learn advanced\n usage of Modern.js Module.\n * I need to expand my project capabilities and need to learn how to develop\n plugins for Modern.js Module.","routePath":"/module-tools/en/guide/intro/getting-started","lang":"en","toc":[{"text":"3 minute demo","id":"3-minute-demo","depth":2,"charIndex":3},{"text":"Create new project","id":"create-new-project","depth":3,"charIndex":209},{"text":"Add to an existing project","id":"add-to-an-existing-project","depth":3,"charIndex":855},{"text":"Core npm Package","id":"core-npm-package","depth":3,"charIndex":1577},{"text":"View official example","id":"view-official-example","depth":3,"charIndex":2272},{"text":"Let's get started","id":"lets-get-started","depth":2,"charIndex":2407}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":33,"title":"Welcome to Modern.js Module","content":"#\n\nModern.js Module is a modules engineering solution for Modern.js, as well as a\ncore dependency. It allows developers to build, debug, and publish module type\nproject more easily. A module type project can mostly be thought of as an npm\npackage type project, which may be a component, component library or tool\nlibrary project.\n\nIf you are planning to develop a project of the npm package type, then you came\nto the right place! Modern.js provides a professional Modern.js Module. It gives\nyou:\n\n * Simple project initialization: simply execute the npx @modern-js/create\n project-dir command, followed by a few interactive questions, to create a\n complete module type project. The created project also supports the choice of\n two package managers, pnpm and Yarn.\n * Code formatting: In Modern.js Module, you can execute modern lint to format\n the code. The initialized module project includes the ESLint ruleset for\n Modern.js for most scenarios.\n * Comprehensive build capabilities and faster builds: Modern.js Module provides\n high-performance build capabilities based on esbuild and SWC, and provides\n rich configurations for different build scenarios.\n * Storybook debugging tools: Modern.js Module provides Storybook debugging\n tools for debugging module projects. After installing the Storybook plugin\n for Modern.js Module, you can start it with the storybook dev command. You\n can use Storybook not only for debugging components, but also for other types\n of modules.\n * Versioning based on Changesets: When you need to record changes to a project,\n you can use the modern change command to generate a Markdown file containing\n the changes; when you need to upgrade a project, you can use the modern bump\n command to analyze and upgrade the version through the Markdown file; when\n you need to release a project, you can use the modern release command to\n release the project; Modern.js Module implements these commands based on\n Changesets.\n * Extensible plugin mechanism: Want to integrate additional debugging tools for\n your project? Or maybe you want to do some extra processing during the build\n process, Modern.js Module provides a plugin mechanism and plugin hooks that\n cover both the dev command and the build command process. You can use them to\n extend the capabilities of your project.\n * Lots more! Modern.js Module will continue to optimize its build and debug\n features in the future. If there are important issues to be solved in module\n project building, or if a mainstream module project debugging tool or pattern\n emerges, then they will probably be supported by Modern.js Module.","routePath":"/module-tools/en/guide/intro/welcome","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":34,"title":"Why you need Modern.js Module","content":"#\n\nYou've probably all experienced it: when developing a component library or tool\nlibrary from scratch, we have to consider not only how to write the code logic\nof the project itself, but also how to build, debug, test, format the code, and\nother things that have nothing to do with the code logic.\n\nFor example, when we consider which builder is used to build the code for a\nmodule project, we might previously consider webpack or Rollup, but now we might\nalso consider esbuild or SWC.\n\nRegardless of which builder is chosen, this is going to be a costly learning\ncurve for developers who are not skilled in the use of these build tools. Even\nif you want to use them quickly, it will take a lot of time and effort.\n\nIn addition to the build, things like providing debugging tools for projects,\nsupporting testing capabilities, adding code format validation, etc. can take a\nlong time and effort for a novice to understand or master them and actually\nserve the current project.\n\nTo ensure the quality of the code and the integrity of the project, we often\nneed to do these things that are not related to the logical implementation of\nthe code. However, these things are likely to affect the overall project\ndevelopment progress, reduce the developer's development experience, and make\nthe developer feel that the development threshold of the module project is very\nhigh.\n\nIf you have to go through all this work every time you develop a module type\nproject, you will spend most of your development time in the beginning on these\nthings that are not related to code implementation. If we could provide a module\nengineering solution that would help developers to solve the project engineering\nissues and allow them to focus more on code implementation, it would greatly\nimprove the module type project development experience.\n\n\n\nModern.js, in order to make developing module type projects easier, provides a\nmodule engineering solution in order to solve the above mentioned problems and\nprovides the main features using Modern.js Module. Modern.js Module can be\nunderstood as a tool dedicated to the development of module type projects.","routePath":"/module-tools/en/guide/intro/why-module-engineering-solution","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":36,"title":"Quick Start","content":"#\n\nModern.js Module not only provides a rich set of features, but also supports\nextending the capabilities of the current project by way of plugins.\n\nWe can quickly see how to write a Modern.js Module plugin by using the following\nexample.\n\n 1. First we create . /plugins/example.ts file under the initialized project.\n\n\n\n 2. Next add the code for the plugin to the example.ts file.\n\n\n\n 3. Then we register the plugin we just wrote via the plugins API.\n\n\n\n 4. Finally, run modern build and you will see:\n\n\n\nWith the above example, we learned the following things.\n\n * The recommended plugin directory structure\n * The initialization code of the plugin\n * Plugin registration\n\nIn addition to the above, we also need to understand.\n\n * plugin objects, type definitions and recommended configuration options\n * setup functions, api object parameters, lifecycle hooks","routePath":"/module-tools/en/plugins/guide/getting-started","lang":"en","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":37,"title":"Plugin Object","content":"#\n\nThe Modern.js Module plugin is an object, and the object contains the following\nproperties.\n\n * name: The name of the plugin, a unique identifier.\n * setup: plugin initialization function, which will be executed only once.\n setup function can return a Hooks object, and Modern.js Module will execute\n the function corresponding to the Hook defined on the Hooks object at a\n specific time.\n\nFor example, in the following plugin code example, the beforeBuild function is\ntriggered before the project starts the build task and the build start log is\nprinted.\n\n\n\n\n\n\nPlugin type definitions#\n\nWhen using TypeScript, you can introduce the built-in CliPlugin and ModuleTools\ntypes to provide the correct type derivation for plugins: ``\n\n\n\n\nPlugin configuration options#\n\nIt is recommended to write the plugin as a function, so that the plugin can\nreceive configuration options via function entry.\n\n","routePath":"/module-tools/en/plugins/guide/plugin-object","lang":"en","toc":[{"text":"Plugin type definitions","id":"plugin-type-definitions","depth":2,"charIndex":570},{"text":"Plugin configuration options","id":"plugin-configuration-options","depth":2,"charIndex":741}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":38,"title":"Setup function","content":"#\n\nIn the \"Plugin object\" section we know that the plugin object contains a setup\nfunction that not only contains an api object parameter, but also returns a\nHooks object.\n\n\nPlugin API objects#\n\nThe setup function of the plugin will provide an api object parameter, and you\ncan call some of the methods provided on this object to get information about\nthe configuration, project context, etc.\n\n\n\n\napi.useAppContext#\n\nUsed to get project context information.\n\n\n\nINFO\n\nThrough the actual type file, we can see that there are some additional fields.\nHowever, for Modern.js Module, the fields mentioned above are the only ones that\nare meaningful. The same applies to other methods of the api object.\n\n\napi.useResolvedConfigContext#\n\nUsed to get the final configuration after parsing.\n\nINFO\n\nIf you need to get the build-related final configuration, you need to use the\nbeforeBuild Hook.\n\n\n\n\napi.useHookRunners#\n\nUsed to get the executors of Hooks and trigger the execution of a specific Hook.\n\n\n\n\nAsynchronous setup#\n\nThe setup of a CLI plugin can be an asynchronous function that performs\nasynchronous logic during the initialization process.\n\n\n\nNote that the setup function of the next plugin is not executed until the async\nsetup function of the current plugin has finished. Therefore, you should avoid\nperforming time-consuming asynchronous operations in the setup function to avoid\nslowing down the startup performance of the CLI.\n\n\nLife cycle hooks#\n\nWe know that the setup function returns a Hooks object, which can also be\nunderstood as an object with Modern.js Module lifecycle hooks.\n\nCurrently there are two main types of hooks.\n\n * build hooks: triggered only when the build command is executed to build the\n source code product.\n * buildPlatform hook: triggered only when the build --platform command is\n executed to generate other build artifacts.\n * debug hooks: hooks that are triggered when running the dev command.\n\nSee the API documentation for a full list of lifecycle hooks.","routePath":"/module-tools/en/plugins/guide/setup-function","lang":"en","toc":[{"text":"Plugin API objects","id":"plugin-api-objects","depth":2,"charIndex":173},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"Asynchronous setup","id":"asynchronous-setup","depth":2,"charIndex":993},{"text":"Life cycle hooks","id":"life-cycle-hooks","depth":2,"charIndex":1434}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":39,"title":"Overview","content":"#\n\n\nOfficial Plugins#\n\n * @modern-js/plugin-module-import:Use SWC to provide the same ability as\n babel-plugin-import.\n * @modern-js/plugin-module-banner:Add custom content, such as copyright\n information, to the top and bottom of each JS and CSS file.\n * @modern-js/plugin-module-node-polyfill: Inject Polyfills of Node core modules\n in the browser side.\n * @modern-js/plugin-module-polyfill:Inject polyfill for unsupported features\n used in your code.\n * @modern-js/plugin-module-babel:Use Babel to transform your code.\n * @modern-js/plugin-module-vue:Support for Vue component.","routePath":"/module-tools/en/plugins/official-list/overview","lang":"en","toc":[{"text":"Official Plugins","id":"official-plugins","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":40,"title":"Babel Plugin","content":"#\n\nTIP\n\nNormally, we don't need to use Babel to transform our code, this plugin is only\nused as a downgrade.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nYou can also configure the registration via hooks, for example, if you need to\nbundle two files A and B at the same time and only need to use babel when bundle\nA:\n\n\n\n\nConfig#\n\nSee babel options.\n\nHere is an example with @babel/preset-env configured\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-babel","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":110},{"text":"Install","id":"install","depth":3,"charIndex":125},{"text":"Register","id":"register","depth":3,"charIndex":136},{"text":"Config","id":"config","depth":2,"charIndex":372}],"domain":"","frontmatter":{},"version":""},{"id":41,"title":"Banner Plugin","content":"#\n\nProvide the ability to inject content at the top and bottom of each JS and CSS\nfile.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nYou can install the plugin with the following command:\n\n\n\nTIP\n\nNote: CSS comments do not support the //comment syntax. Refer to \"CSS Comments\"\n\n\nExample#\n\n\nAdd copyright information at the top of a JS file#\n\n\n\n\nConfiguration#\n\n * Type\n\n\n\n\nbanner#\n\nAdd content at the top.\n\n * banner.js: Add content at the top of a JS file.\n * banner.css: Add content at the top of a CSS file.\n\n\nfooter#\n\nAdd content at the bottom.\n\n * footer.js: Add content at the bottom of a JS file.\n * footer.css: Add content at the bottom of a CSS file.","routePath":"/module-tools/en/plugins/official-list/plugin-banner","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":89},{"text":"Install","id":"install","depth":3,"charIndex":104},{"text":"Register","id":"register","depth":3,"charIndex":115},{"text":"Example","id":"example","depth":2,"charIndex":271},{"text":"Add copyright information at the top of a JS file","id":"add-copyright-information-at-the-top-of-a-js-file","depth":3,"charIndex":282},{"text":"Configuration","id":"configuration","depth":2,"charIndex":337},{"text":"banner","id":"banner","depth":3,"charIndex":365},{"text":"footer","id":"footer","depth":3,"charIndex":505}],"domain":"","frontmatter":{},"version":""},{"id":42,"title":"Import Plugin","content":"#\n\nUsing SWC provides the same ability and configuration as babel-plugin-import.\n\nTIP\n\nSince @modern-js/module-tools version >= 2.16.0, this plugin functionality is\nbuilt into Modern.js Module and is provided by transformImport.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nThis way we can use the ability of automatic import in Modern.js Module.\n\n\nConfigurations#\n\n * Type:\n\n\n\n\npluginImport#\n\n * Type: object[]\n\nThe elements of the array are configuration objects for babel-plugin-import,\nwhich can be referred to options。\n\nExample:\n\n\n\n\nNotes#\n\nSWC (Speedy Web Compiler) is written in Rust, and this plugin is based on SWC\nand ported from babel-plugin-import. The configuration options remain\nconsistent.\n\nSome configurations can be passed in as functions, such as customName,\ncustomStyleName, etc., but in Modern.js Module, we do not recommend using\nfunctions in these configuration items. Because we will call SWC in the esbuild\nplugin, and then when Rust calls these configuration functions through Node-API,\na deadlock will occur.\n\nSimple function logic can actually be replaced by template language. Below is an\nexample of using a template with customName:\n\n\n\nAdd the following configuration on the right-hand side:\n\n\n\nThe {{ member }} in it will be replaced with the corresponding import member.\nAfter transformation:\n\n\n\nTemplate customName: 'foo/es/{{ member }}' is the same as customName: (member)\n=> `foo/es/${member}` , but template value has no performance overhead of\nNode-API.\n\nThe template used here is handlebars. There are some useful builtin tools, Take\nthe above import statement as an example:\n\n\n\nTransformed to:\n\n\n\nIn addition to kebabCase, there are cameraCase, snakeCase, upperCase and\nlowerCase can be used as well.","routePath":"/module-tools/en/plugins/official-list/plugin-import","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":230},{"text":"Install","id":"install","depth":3,"charIndex":245},{"text":"Register","id":"register","depth":3,"charIndex":256},{"text":"Configurations","id":"configurations","depth":2,"charIndex":413},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":443},{"text":"Notes","id":"notes","depth":2,"charIndex":602}],"domain":"","frontmatter":{},"version":""},{"id":43,"title":"Node Polyfill Plugin","content":"#\n\nAbout Node Polyfill\n\nNormally, we don't need to use Node libs on the browser side. However, it is\npossible to use some Node libs when the code will run on both the Node side and\nthe browser side, and Node Polyfill provides browser versions of polyfills for\nthese Node libs.\n\nBy using the Node Polyfill plugin, Node core libs polyfills are automatically\ninjected into the browser-side, allowing you to use these modules on the browser\nside with confidence.\n\n\nQuick Start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nConfigurations#\n\n * Type:\n\n\n\n\nexclude#\n\nExclude the Node Polyfill to be injected.\n\n\n\n\noverrides#\n\nOverride the built-in Node Polyfill.\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\nWhen the above global variables are used directly in code, the corresponding\npolyfill will be injected.\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\nWhen the above module is referenced in code via import / require syntax, the\ncorresponding polyfill will be injected.\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\nCurrently there is no polyfill for the above modules on the browser side, so\nwhen you import the above modules, it will automatically fallback to an empty\nobject.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-node-polyfill","lang":"en","toc":[{"text":"Quick Start","id":"quick-start","depth":2,"charIndex":460},{"text":"Install","id":"install","depth":3,"charIndex":475},{"text":"Register","id":"register","depth":3,"charIndex":486},{"text":"Configurations","id":"configurations","depth":2,"charIndex":569},{"text":"exclude","id":"exclude","depth":3,"charIndex":599},{"text":"overrides","id":"overrides","depth":3,"charIndex":655},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":708},{"text":"Globals","id":"globals","depth":3,"charIndex":726},{"text":"Modules","id":"modules","depth":3,"charIndex":877},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":1336}],"domain":"","frontmatter":{},"version":""},{"id":44,"title":"Polyfill Plugin","content":"#\n\nTIP\n\nNormally, we don't need to inject polyfill for npm packages, this step should be\ndone on the web application framework side, but in some scenarios we need to\ninject polyfill in order to make our library run directly in low version\nbrowsers.\n\nNote that this plugin does not transform your code syntax, it only injects\npolyfill for unsupported functions used in your code, importing them as normal\nfunctions instead of polluting the global. You need to install the core-js-pure\ndependency.\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\nYou can also configure registration via hooks, for example, if you have multiple\nbuild configurations at the same time and only need to inject the polyfill when\nbundle:\n\n\n\n\nConfig#\n\n * Type\n\n\n\n\ntargets#\n\nSee Babel target.\n\nThis is a example.\n\n","routePath":"/module-tools/en/plugins/official-list/plugin-polyfill","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":497},{"text":"Install","id":"install","depth":3,"charIndex":512},{"text":"Register","id":"register","depth":3,"charIndex":523},{"text":"Config","id":"config","depth":2,"charIndex":778},{"text":"targets","id":"targets","depth":3,"charIndex":799}],"domain":"","frontmatter":{},"version":""},{"id":45,"title":"Vue Plugin","content":"#\n\nThe Vue plugin provides support for building Vue 3 components. The plugin\ninternally integrates esbuild-plugin-vue3 and @vue/babel-plugin-jsx。\n\nWARNING\n\nNotice that we have some limitation:\n\n 1. The current implementation of this plugin integrates directly with the\n community plugin and therefore does not support writing jsx/tsx in sfc.\n 2. If you want to generate d.ts for the components, please use the official\n recommendation vue-tsc.\n 3. Only support bundle, we recommend to set input to ['src/**/*.vue'] or\n ['src/index.ts'].\n\n\nQuick start#\n\n\nInstall#\n\n\nRegister#\n\nIn Modern.js Module, you can register plugins in the following way:\n\n\n\n\nOptions#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\nOptions passed to @vue/babel-plugin-jsx, please refer to the\n@vue/babel-plugin-jsx documentation for detailed usage.","routePath":"/module-tools/en/plugins/official-list/plugin-vue","lang":"en","toc":[{"text":"Quick start","id":"quick-start","depth":2,"charIndex":547},{"text":"Install","id":"install","depth":3,"charIndex":562},{"text":"Register","id":"register","depth":3,"charIndex":573},{"text":"Options","id":"options","depth":2,"charIndex":656},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":667}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file diff --git a/modern-js/module-tools/static/search_index.zh.62c236ba.json b/modern-js/module-tools/static/search_index.zh.62c236ba.json deleted file mode 100644 index 79359db751..0000000000 --- a/modern-js/module-tools/static/search_index.zh.62c236ba.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":46,"title":"buildConfig","content":"#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项,它包含了构建的所有配置。\n\n * 类型:object | object[]\n\nTIP\n\n在开始使用 buildConfig 之前,请先阅读以下文档来了解其作用:\n\n * 修改输出产物\n * 深入理解构建\n\n\nalias#\n\n * 类型:Record | Function\n * 默认值:{'@': 'src',}\n\nTIP\n\n对于 TypeScript 项目,只需要在 tsconfig.json 中配置 compilerOptions.paths, Modern.js Module\n会自动识别 tsconfig.json 里的别名,因此不需要额外配置 alias 字段。\n\n\n\n以上配置完成后,如果在代码中引用 @common/Foo.tsx, 则会映射到 /src/common/Foo.tsx 路径上。\n\nalias 的值定义为函数时,可以接受预设的 alias 对象,并对其进行修改。\n\n\n\n也可以在函数中返回一个新对象作为最终结果,新对象会覆盖预设的 alias 对象。\n\n\n\n\nasset#\n\n包含静态资源相关的配置。\n\n\nasset.name#\n\n静态资源输出文件名。\n\n * 类型: string | ((assetPath) => name)\n * 默认值: [name].[hash].[ext]\n\n当 asset.name 为 string 类型时,会自动对 [name]、[ext]、[hash] 进行替换,分别替换为文件名、拓展名、文件 hash。\n如果想要更高的自由度,可以把 asset.name 作为方法使用,返回值即为文件名。此时,该方法接收一个参数 assetPath,对应资源路径。\n\n\n\n\nasset.limit#\n\n用于设置静态资源被自动内联为 base64 的体积阈值。\n\nModern.js Module 在进行打包时,默认会内联体积小于 10KB 的图片、字体、媒体等资源,将它们通过 Base64\n编码,并内联到产物中,不再会发送独立的 HTTP 请求。\n\n你可以通过修改 limit 参数来调整这个阈值。\n\n * 类型: number\n * 默认值: 10 * 1024\n\n例如,将 limit 设置为 0 来避免资源内联:\n\n\n\n\nasset.path#\n\n静态资源输出路径,会基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: assets\n\n\nasset.publicPath#\n\n打包时给未内联资源的 CDN 前缀。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n此时,所有静态资源都会添加 https://xxx/ 前缀。\n\n\nasset.svgr#\n\n打包时将 SVG 作为一个 React 组件处理,options 参考 svgr,另外还支持了 include 和 exclude\n两个配置项,用于匹配需要处理的 SVG 文件。\n\n * 类型: boolean | object\n * 默认值: false\n\n开启 svgr 功能后,可以使用默认导出的方式将 SVG 当做组件使用。\n\n\n\n当开启功能后,可以新建一个类型描述文件,并在 modern-app-env.d.ts 文件中增加,修改使用 SVG 的类型:\n\n\n\n\n\n\nasset.svgr.include#\n\n设定匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: /\\.svg$/\n\n\nasset.svgr.exclude#\n\n设定不匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: undefined\n\n\nasset.svgr.exportType#\n\n用于配置使用 SVGR 时 SVG 的导出形式。\n\n * 类型: 'named' | 'default'\n * 默认值: default\n\n当此选项设置为 'named' 时,你可以使用以下语法导入组件:\n\n\n\n命名导出默认为 ReactComponent,并可以通过 asset.svgr.namedExport 进行自定义。\n\n\nautoExtension#\n\n根据 format 和 type 自动添加产物里 js 文件和类型描述文件的后缀。\n\n * 类型:boolean\n * 默认值:false\n * 版本:>=2.38.0\n\n关闭时,js 产物后缀为 .js,类型描述文件后缀为 d.ts。\n\n开启后,当 type 为 module 时,node 默认将 .js 作为 esm 加载,因此当我们要输出 cjs 产物时,js 产物后缀为\n.cjs,类型描述文件后缀为 d.cts; 反之,如果缺少 type 字段或者 type 为 commonjs 时, node 默认将 .js 文件作为 cjs\n加载,因此当我们要输出 esm 产物时,js 产物后缀为 .mjs,类型描述文件后缀为 d.mts。\n\nWARNING\n\n在 bundleless 模式下使用时,我们会有一步额外的操作,那就是处理每个文件里的 import/export 语句。我们会给相对路径加上 js\n文件后缀,可能是 .mjs 或者 .cjs,这取决于你的包配置,此行为可以通过 redirect.autoExtension关闭。\n\n注意 noUselessIndex 规则会破坏此行为,你需要禁用此规则 如果你需要在 bundleless 使用此配置,请补齐 index,例如 utils\n是一个文件夹, 你需要将 改写为\n\n\n\n\nautoExternal#\n\n自动外置项目的 \"dependencies\" 和 \"peerDependencies\",不会将其打包到最终的 bundle 产物中。\n\n * 类型: boolean | object\n * 默认值: true\n\n当我们希望关闭对于第三方依赖的默认处理行为时候,可以通过以下方式来实现:\n\n\n\n这样对于 \"dependencies\" 和 \"peerDependencies\" 下面的依赖都会进行打包处理。如果只想要关闭其中某个下面的依赖处理,则可以使用\nbuildConfig.autoExternal 的对象形式:\n\n\n\n\nautoExternal.dependencies#\n\n是否需要外置项目的 \"dependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nautoExternal.peerDependencies#\n\n是否需要外置项目的 \"peerDependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nbanner#\n\n提供为每个 JS , CSS 和 DTS 文件的顶部和底部注入内容的能力。\n\n\n\n * 类型: BannerAndFooter\n * 默认值: {}\n * 版本: >=2.36.0\n\n例如你想为 JS 和 CSS 文件添加版权信息:\n\n\n\n\nbuildType#\n\n构建类型,bundle 会打包你的代码,bundleless 只做代码的转换。\n\n * 类型: 'bundle' | 'bundleless'\n * 默认值: 'bundle'\n\n\ncopy#\n\n将文件或目录拷贝到指定位置。\n\n * 类型: object\n\n\n\n\ncopy.patterns#\n\n * 类型: CopyPattern[]\n * 默认值: []\n\n\n\n\ncopy.options#\n\n * 类型:\n\n\n\n * 默认值: { concurrency: 100, enableCopySync: false }\n\n * concurrency: 指定并行执行多少个复制任务。\n\n * enableCopySync: 使用 fs.copySync,默认情况下 fs.copy。\n\n\ndefine#\n\n定义全局变量,注入到代码中\n\n * 类型: Record\n * 默认值: {}\n\n由于 define 功能是由全局文本替换实现的,所以需要保证全局变量值为字符串,更为安全的做法是将每个全局变量的值转化为字符串,如下所示:\n\nINFO\n\n框架内部会自动进行 JSON 序列化处理,因此不需要手动执行序列化。\n\n如果不需要自动序列化,可以通过配置 esbuildOptions 定义 alias 来实现。\n\n\n\n不过要注意:如果项目是一个 TypeScript 项目,那么你可能需要在项目源代码目录下的 .d.ts 文件里增加以下内容:\n\n> 如果不存在 d.ts 文件,则可以手动创建。\n\n\n\n我们也可以进行环境变量替换:\n\n\n\n通过上面的配置,我们就可以将下面这段代码:\n\n\n\n在执行 VERSION=1.0.0 modern build 的时候,转换为:\n\n\n\nTIP\n\n为了防止全局替换替换过度,建议使用时遵循以下两个原则:\n\n * 全局常量使用大写\n * 自定义全局常量前缀后缀,确保独一无二\n\n\ndts#\n\n类型文件生成的相关配置,默认情况会生成。\n\n * 类型: false | object\n * 默认值:\n\n\n\n\ndts.abortOnError#\n\n用于控制在出现类型错误的时候,是否允许构建成功。\n\n * 类型:boolean\n * 默认值:true\n\n默认情况下,在出现类型错误的时候会导致构建失败。将 abortOnError 设置为 false 后,即使代码中出现了类型问题,构建依然会成功:\n\n\n\nWARNING\n\n当关闭该配置后,无法保证类型文件能正常生成,且不保证内容正确。在 buildType: 'bundle' 时,即打包模式下,类型文件一定不会生成。\n\n\ndts.distPath#\n\n类型文件的输出路径,基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: ./\n\n比如输出到 outDir 下面的 types 目录:\n\n\n\n\ndts.enableTscBuild#\n\n开启 tsc '--build' 选项。当使用 project reference 时, 可以使用 '--build'\n选项以实现项目之间的协同工作以加快构建速度。\n\n此选项要求版本 > 2.43.0, 事实上,我们在 2.42.0 版本曾试验性地开启此选项,但其带来的许多问题使我们不得不动态开启。\n\n\n\n * 类型: boolean\n * 默认值: false\n * 版本: >2.43.0\n\n\n\n\ndts.only#\n\n是否在构建时只生成类型文件,不生成 JavaScript 产物文件。\n\n * 类型: boolean\n * 默认值: false\n\n\n\n\ndts.respectExternal#\n\n当设为 false 时,不会打包任何三方包类型,设为 true 时,会根据 externals 来决定是否需要打包三方类型。\n\n在对类型文件进行打包时,构建工具还未对 export\n进行分析,因此当你引用的任何一个三方包出现类型错误时,都可能会中断当前的构建流程,这会导致构建流程不可控,因此我们可以通过这个配置来避免该问题。\n\n * 类型: boolean\n * 默认值: true\n\n\n\n\ndts.tsconfigPath#\n\n废弃,使用 tsconfig 配置替代。\n\n指定用于生成类型文件的 tsconfig 文件路径。\n\n\n\n\nesbuildOptions#\n\n用于修改底层的 esbuild 配置。\n\n * 类型: Function\n * 默认值: c => c\n\n例如,我们需要修改生成文件的后缀:\n\n\n\n例如,注册一个 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\nTIP\n\n我们在原本 esbuild 构建的基础上做了许多扩展,因此使用此配置需要注意以下几点:\n\n 1. 优先使用 Modern.js Module 提供的配置,例如 esbuild 并不支持 target: 'es5',但我们内部使用 SWC\n 支持了此场景,此时通过 esbuildOptions 设置target: 'es5'会报错。\n 2. 目前我们内部使用 enhanced-resolve 替代了 esbuild 的 resolve 解析算法,所以修改 esbuild resolve\n 相关配置无效,计划在未来会切换回来。\n\n\nexternalHelpers#\n\n默认情况下,输出的 JS 代码可能会依赖一些辅助函数来支持目标环境或者输出格式,这些辅助函数会被内联在需要它的文件中。\n\n使用此配置,将会使用 SWC 对代码进行转换,将内联的辅助函数转换为从外部模块 @swc/helpers 导入这些辅助函数。\n\n * 类型:boolean\n * 默认值:false\n\n下面是使用该配置前后的产物变化比较。\n\n开启前:\n\n\n\n开启后:\n\n\n\n\nexternals#\n\n用于在打包时排除一些外部依赖,避免将这些依赖打包到最终的 bundle 中。\n\n * 类型:\n\n\n\n * 默认值: []\n * 构建类型:仅支持 buildType: 'bundle'\n * 示例:\n\n\n\n\nfooter#\n\n同 banner 配置,用于在输出文件末尾添加注释。\n\n\nformat#\n\n用于设置 JavaScript 产物输出的格式,其中 iife 和 umd 只在 buildType 为 bundle 时生效。\n\n * 类型:'esm' | 'cjs' | 'iife' | 'umd'\n * 默认值:cjs\n\n\nformat: esm#\n\nesm 代表 \"ECMAScript 模块\",它需要运行环境支持 import 和 export 语法。\n\n * 示例:\n\n\n\n\nformat: cjs#\n\ncjs 代表 \"CommonJS\",它需要运行环境支持 exports、require 和 module 语法,通常为 Node.js 环境。\n\n * 示例:\n\n\n\n\nformat: iife#\n\niife 代表 \"立即调用函数表达式\",它将代码包裹在函数表达式中,确保代码中的任何变量不会意外地与全局范围中的变量冲突,通常在浏览器环境中运行。\n\n * 示例:\n\n\n\n\nformat: umd#\n\numd 代表 \"Universal Module Definition\",用于在不同环境(浏览器、Node.js 等)中运行。umd\n格式的模块可以在多种环境下使用,既可以作为全局变量访问,也可以通过模块加载器(如 RequireJS)进行模块化加载。\n\n * 示例:\n\n\n\n\nhooks#\n\n构建生命周期钩子,允许在构建流程的特定阶段注入自定义逻辑。\n\n * 类型:\n\n\n\n * 默认值:[]\n\n我们可以在 apply 方法里拿到 compiler 实例,修改其属性,以及在不同阶段执行自定义逻辑,对于 Hook 的详细介绍, 参考使用 Hook\n介入构建流程。\n\n\n\n\ninput#\n\n指定构建的入口文件,数组形式可以指定目录。\n\n * 类型:\n\n\n\n * 默认值:bundle 模式下默认为 ['src/index.ts'],bundleless 模式下默认为 ['src']\n\n数组用法:\n\n在 bundle 模式下,下面的配置会以 src/index.ts 和 src/index2.ts 为入口分别进行构建。bundle 模式不支持配置 input\n为目录。\n\n\n\n在 bundleless 模式下,下面的配置会同时处理 src/a 目录下的文件和 src/index.ts 文件。\n\n\n\n在 bundleless 模式下,数组模式还支持使用 ! 来过滤部分文件:\n\n\n\n上面的配置将打包 src 目录下的文件,同时会过滤以 spec.ts 为后缀的文件。这在测试文件与源码文件在同一个根目录下的情况会很有用。\n\n对象用法:\n\n当在 bundle 模式下需要修改产物的输出文件名称的时候,可以使用对象形式进行配置。\n\n对象的 Key 是产物的文件名称,Value 是源码的文件路径。\n\n\n\n\njsx#\n\n指定 JSX 的编译方式,默认支持 React 17 及更高版本,自动注入 JSX 运行时代码。\n\n * 类型: automatic | transform | preserve\n * 默认值: automatic\n\n如果你需要支持 React 16,则可以设置 jsx 为 transform:\n\n\n\nTIP\n\n如果你不需要转换 JSX ,可以设置 jsx 为 preserve, 但此时请不要使用 swc 做代码转换。 关于 JSX Transform\n的更多说明,可以参考以下链接:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\n这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。\n\n * 类型:boolean\n * 默认值:false\n * 构建类型:仅支持 buildType: 'bundle'\n\n开启 metafile 生成:\n\n\n\n在执行 build 构建后,产物目录下会生成 metafile-[xxx].json 文件,你可以通过 esbuild analyze 和\nbundle-buddy 等工具进行可视化分析。\n\n\nminify#\n\n使用 esbuild 或者 terser 压缩代码,也可以传入 terserOptions。\n\n * 类型: 'terser' | 'esbuild' | false | object\n * 默认值: false\n\n\n\n\noutDir#\n\n指定构建的输出目录。\n\n * 类型: string\n * 默认值: ./dist\n\n\n\n\nplatform#\n\n默认生成用于 Node.js 环境下的代码,你也可以指定为 browser,会生成用于浏览器环境的代码。 查看esbuild.platform了解更多。\n\n * 类型: 'browser' | 'node'\n * 默认值: 'node'\n\n\n\n\nredirect#\n\n在 buildType: 'bundleless' 构建模式下,会对引用路径进行重定向,确保指向了正确的产物,例如:\n\n * import './index.less' 会被改写成 import './index.css'\n * 会被改写成 (依实际情况而定)\n * 会被改写成 (如果生成了 utils.mjs,视实际情况而定)\n\n在某些场景下,你可能不需要这些功能,那么可以通过此配置关闭它,关闭后,其引用路径将不会发生改变。\n\n\n\n\nresolve#\n\n自定义模块解析选项\n\n\nresolve.alias#\n\n基本用法和 alias 一致。\n\nalias 的问题在于我们在 bundleless 场景下错误的处理了 Module ID 的情况:\n\n\n\n当我们配置了 alias: { react: 'react-native' } 后,结果会变成\n\n\n\n一个 Module ID 被错误的处理成了相对路径,显然这是不符合预期的。\n\n我们想要修复这个问题,但是这可能会破坏已有的项目,因此我们在 2.58.0 版本提供了 resolve.alias 来解决这个问题。 并且\nresolve.alias 里移除了 alias 提供的默认值 { \"@\": \"./src\"}\n\n如果你需要此功能,请使用 resolve.alias, 注意不要与 alias 混用。\n\n在下一个大版本,resolve.alias 将会取代 alias 。\n\n\nresolve.mainFields#\n\npackage.json 中,在解析包的入口点时尝试的字段列表。\n\n * 类型:string[]\n * 默认值:取决于platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * 版本:>=2.36.0\n\n例如,我们想要先加载 js:source 字段:\n\n\n\nWARNING\n\nresolve.mainFields 比 package.json 中 exports 字段的优先级低,如果一个入口点从 exports\n成功解析,resolve.mainFields 将被忽略。\n\n\nresolve.jsExtentions#\n\n支持隐式文件扩展名\n\n * 类型: string[]\n * 默认值: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * 版本:>=2.36.0\n\n对于 css 文件,请不要使用隐式文件扩展名,目前 Module 仅支持 ['.less', '.css', '.sass', '.scss'] 后缀。\n\nNode 的解析算法不会将 .mjs 和 cjs 视为隐式文件扩展名,因此这里默认也不会,但是可以通过更改此配置来包含:\n\n\n\n\nshims#\n\n在构建 cjs / esm 产物时注入一些垫片代码。\n\n例如 __dirname 只能在 commonjs 里使用,开启此选项后,当产物格式为 esm 时,会将 __dirname 编译为\npath.dirname(fileURLToPath(import.meta.url))。\n\n详细代码见 shims, 需要注意的是 esm shims 只会在 platform 为 node 时注入,因为用到了 url 模块。\n\n * 类型: boolean\n * 默认值: false\n * 版本:>=2.38.0\n\n\n\n\nsideEffects#\n\n配置模块的副作用\n\n * 类型: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * 默认值: undefined\n\n通常情况下,我们通过 package.json 的 \"sideEffects\" 字段来配置模块的副作用,但是在某些情况下,三方包的 package.json\n是不可靠的。 例如我们引用了一个三方包的样式文件。\n\n\n\n但是这个三方包的 package.json 里并没有将样式文件配置到 \"sideEffects\" 里。\n\n\n\n同时你又设置了 style.inject 为 true,在控制台可以看到类似的警告信息:\n\n\n\n这时候就可以使用这个配置项,手动配置模块的\"sideEffects\",配置支持正则和函数形式。\n\n\n\nTIP\n\n添加此配置后,打包时将不会再读取 package.json 里的 \"sideEffects\" 字段。\n\n\nsourceDir#\n\n指定构建的源码目录,默认为 src,用于在 bundleless 构建时基于源码目录结构生成对应的产物目录。 等同于esbuild.outbase。\n\n * 类型: string\n * 默认值: src\n\n\nsourceMap#\n\n控制 sourceMap 如何生成。\n\n * 类型: boolean | 'inline' | 'external'\n * 默认值: false\n\n\nsourceType#\n\nWARNING\n\n已废弃,此配置不会产生任何影响。\n\n设置源码的格式。默认情况下,会将源码作为 EsModule 进行处理。当源码使用的是 CommonJS 的时候,需要设置 commonjs。\n\n * 类型:'commonjs' | 'module'\n * 默认值:'module'\n\n\nsplitting#\n\n是否开启代码分割。 仅支持 format: 'esm' 和 format: 'cjs',查看esbuild.splitting了解更多。\n\n * 类型: boolean\n * 默认值: false\n\n\nstyle#\n\n配置样式相关的配置。\n\n\nstyle.less#\n\nless 相关配置。\n\n\nstyle.less.lessOptions#\n\n详细配置参考 less。\n\n * 类型: object\n * 默认值: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\n在入口文件起始添加 Less 代码。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n\nstyle.less.implementation#\n\n配置 Less 使用的实现库,在不指定的情况下,使用的内置版本是 4.1.3。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置 object 类型时,可以指定 Less 的实现库。\n\n\n\nstring 类型时,指定 Less 的实现库的路径\n\n\n\n\nsass#\n\nSass 相关配置。\n\n\nstyle.sass.sassOptions#\n\n详细配置参考 node-sass\n\n * 类型: object\n * 默认值: {}\n\n\nstyle.sass.additionalData#\n\n在入口文件起始添加 Sass 代码。\n\n * 类型: string | Function\n * 默认值: undefined\n\n\n\n\nstyle.sass.implementation#\n\n配置 Sass 使用的实现库,在不指定的情况下,使用的内置版本是 1.5.4。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置为 object 类型时,可以指定 Sass 的实现库。\n\n\n\nstring 类型时,指定 Sass 的实现库的路径\n\n\n\n\nstyle.postcss#\n\n用于配置 PostCSS 的选项,传入的值会与默认配置通过 Object.assign 合并。注意 Object.assign 是浅拷贝,因此会完全覆盖内置的\nplugins 数组。\n\n详细配置请查看 PostCSS。\n\n * 类型:\n\n\n\n * 默认值:\n\n\n\n * 示例:\n\n\n\n\nstyle.inject#\n\n配置打包模式下是否将 CSS 样式插入到 JavaScript 代码中。\n\n * 类型: boolean\n * 默认值: false\n\n将 inject 设置为 true 来开启此功能:\n\n\n\n开启后,你会看到源码中引用的 CSS 代码被包含在了打包后的 JS 产物中。\n\n例如,你在源码里写了 import './index.scss',那么在产物中你会看到以下代码:\n\n\n\nTIP\n\n开启 inject 后,你需要注意以下几点:\n\n * CSS 文件中的 @import 不会被处理。如果你的 CSS 文件中有 @import ,那么你需要在 JS 文件中手动引入 CSS\n 文件(less,scss 文件不需要,因为它们会有预处理)。\n * 需要考虑 sideEffects 的影响。默认情况下,我们的构建器会认为 CSS 是有副作用的,如果你的项目中或者三方包的 package.json\n 设置了 sideEffects 字段并且没有包含此 CSS 文件,那么你将会得到一个警告:\n\n\n\n此时可以通过配置 sideEffects 来解决。\n\n\nstyle.autoModules#\n\n根据文件名自动启用 CSS Modules。\n\n * 类型: boolean | RegExp\n * 默认值: true\n\ntrue : 为以 .module.css .module.less .module.scss .module.sass 文件名结尾的样式文件启用 CSS\nModules。\n\nfalse : 禁用 CSS Modules.\n\nRegExp : 为匹配正则条件的所有文件启用 CSS Modules.\n\n\nstyle.modules#\n\nCSS Modules 配置。\n\n * 类型: object\n * 默认值: {}\n\n一个常用的配置是 localsConvention,它可以改变 CSS Modules 的类名生成规则。\n\n\n\n对于以下样式:\n\n\n\n你可以使用 styles.boxTitle 来访问。\n\n详细配置查看 postcss-modules\n\n\nstyle.tailwindcss#\n\n用于修改 Tailwind CSS 的配置项。\n\n * 类型: object | Function\n * 默认值:\n\n\n\n\n启用 Tailwind CSS#\n\n在使用 style.tailwindcss 之前,你需要启用 Modern.js Module 的 Tailwind CSS 插件。\n\n请阅读「使用 Tailwind CSS」 章节来了解开启方式。\n\n\n类型#\n\n值为 object 类型时,与默认配置通过 Object.assign 合并。\n\n值为 Function 类型时,函数返回的对象与默认配置通过 Object.assign 合并。\n\n其他的使用方式和 Tailwind CSS 一致: 快速传送门。\n\n\n注意事项#\n\n注意:\n\n * 如果你同时使用了 tailwind.config.{ts,js} 文件和 tools.tailwindcss 选项,那么\n tools.tailwindcss 定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n * 如果你同时使用了 designSystem 配置项,那么 Tailwind CSS 的 theme 配置将会被 designSystem 的值所覆盖。\n\n其他配置的使用方式与 Tailwind CSS 官方用法一致,请参考 tailwindcss - Configuration。\n\n\ntarget#\n\ntarget 用于为生成的 JavaScript 代码设置目标环境。它让 Modern.js Module 将目标环境无法识别的 JavaScript\n语法转换为在这些环境中可用的低版本 JavaScript 语法。\n\n * 类型:\n\n\n\n * 默认值: 'es6'\n\n例如,将代码编译到 es5 语法:\n\n\n\n\ntransformImport#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现,使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:object[]\n * 默认值:[]\n\n数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n参考「Import 插件——注意事项」\n\n\ntransformLodash#\n\n是否模块化 lodash 的导入,删除未使用的 lodash 模块,从而减少 lodash 代码体积。这项优化基于 babel-plugin-lodash 和\nswc-plugin-lodash 实现。 使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:boolean\n * 默认值:false\n\n当开启此选项时,Modern.js Module 会自动将 lodash 的代码引用指向子路径。\n\n比如:\n\n\n\n转换后的代码:\n\n\n\n\ntsconfig#\n\nTypeScript 配置文件的路径。\n\n * 类型: string\n * 默认值: tsconfig.json\n * 版本: >=2.36.0\n\n\n\n\numdGlobals#\n\n指定 UMD 产物外部导入的全局变量。\n\n * 类型: Record\n * 默认值: {}\n\n\n\n此时,react 和 react-dom 会被看做是外部导入的全局变量,不会被打包进 UMD 产物中,而是通过 global.React 和\nglobal.ReactDOM 的方式进行访问。\n\n\numdModuleName#\n\n指定 UMD 产物的模块名。\n\n * 类型: string | Function\n * 默认值: name => name\n\n\n\n此时 UMD 产物会去挂载到 global.myLib 上。\n\nTIP\n * 需要遵守 UMD 规范,UMD 产物的模块名不能和全局变量名冲突。\n * 模块名会被转换为驼峰命名,如 my-lib 会被转换为 myLib,可参考toIdentifier。\n\n同时函数形式可以接收一个参数,为当前打包文件的输出路径\n\n","routePath":"/module-tools/api/config/build-config","lang":"zh","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":141},{"text":"asset","id":"asset","depth":2,"charIndex":483},{"text":"asset.name","id":"assetname","depth":2,"charIndex":506},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":753},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":981},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":1052},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":1159},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":1411},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":1510},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":1611},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":1802},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":2393},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":2670},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":2758},{"text":"banner","id":"banner","depth":2,"charIndex":2854},{"text":"buildType","id":"buildtype","depth":2,"charIndex":2984},{"text":"copy","id":"copy","depth":2,"charIndex":3087},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":3128},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":3180},{"text":"define","id":"define","depth":2,"charIndex":3341},{"text":"dts","id":"dts","depth":2,"charIndex":3802},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":3864},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":4097},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":4196},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":4419},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":4499},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":4718},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":4790},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":5293},{"text":"externals","id":"externals","depth":2,"charIndex":5501},{"text":"footer","id":"footer","depth":2,"charIndex":5617},{"text":"format","id":"format","depth":2,"charIndex":5655},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":5780},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":5859},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":5957},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":6058},{"text":"hooks","id":"hooks","depth":2,"charIndex":6211},{"text":"input","id":"input","depth":2,"charIndex":6359},{"text":"jsx","id":"jsx","depth":2,"charIndex":6824},{"text":"metafile","id":"metafile","depth":2,"charIndex":7147},{"text":"minify","id":"minify","depth":2,"charIndex":7385},{"text":"outDir","id":"outdir","depth":2,"charIndex":7505},{"text":"platform","id":"platform","depth":2,"charIndex":7559},{"text":"redirect","id":"redirect","depth":2,"charIndex":7693},{"text":"resolve","id":"resolve","depth":2,"charIndex":7924},{"text":"resolve.alias","id":"resolvealias","depth":3,"charIndex":7946},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":8324},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":8641},{"text":"shims","id":"shims","depth":2,"charIndex":8898},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":9165},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":9607},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":9723},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":9810},{"text":"splitting","id":"splitting","depth":2,"charIndex":9968},{"text":"style","id":"style","depth":2,"charIndex":10081},{"text":"style.less","id":"styleless","depth":2,"charIndex":10102},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":10128},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":10219},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":10303},{"text":"sass","id":"sass","depth":2,"charIndex":10478},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":10498},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":10568},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":10663},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":10839},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":10998},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":11494},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":11728},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":11907},{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":3,"charIndex":11989},{"text":"类型","id":"类型","depth":3,"charIndex":12109},{"text":"注意事项","id":"注意事项","depth":3,"charIndex":12240},{"text":"target","id":"target","depth":2,"charIndex":12530},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":12696},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":12892},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":13134},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":13222},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":13382}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":47,"title":"buildPreset","content":"#\n\n构建的预设字符串或者预设函数。提供开箱即用的构建配置。\n\n * 类型:string | Function\n\n * 默认值: undefined\n\n\nnpm-library#\n\n在类 NPM 包管理器下使用的 Library 通用模式,包含 esm 和 cjs 两种 Bundle 产物,并且包含一份类型文件。\n\nINFO\n\n关于类 NPM 包管理器\n\n * npm\n * yarn\n * pnpm\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-library-with-umd#\n\n在类 NPM 包管理器下使用,并且 Library 支持类似 unpkg 的模式。在预设 'npm-library' 的基础上,额外提供 umd 产物。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component#\n\n在类 NPM 包管理器下使用的 组件(库)通用模式。包含 esm 和 cjs 两种 Bundleless 产物(便于 Tree shaking\n优化),以及包含一份类型文件。\n\n对于源码中包含的样式文件,产物中提供样式的编译产物和样式的源文件。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component-with-umd#\n\n在类 NPM 包管理器下使用的组件(库),同时支持类 unpkg 的模式。 在预设 'npm-component' 的基础上,额外提供 umd 产物。\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\n当想要使用支持其他 ECMAScript 版本的 buildPreset 预设的时候,可以直接在\n'npm-library'、'npm-library-with-umd'、'npm-component'、'npm-component-with-umd'\n这些预设值后面增加想要支持的版本。\n\n例如希望 'npm-library' 预设支持 'es2017',则可以按照如下方式配置:\n\n\n\n\nstring / function#\n\nbuildPreset 除了支持基本的字符串形式,还支持函数形式,可以通过 preset 或者 extendPreset\n参数获取我们提供的预设值,然后进行修改。\n\n以下是两个分别使用 preset 和 extendPreset 的例子:\n\n\n\nextendPreset 里会使用 lodash.merge 进行配置合并\n\n","routePath":"/module-tools/api/config/build-preset","lang":"zh","toc":[{"text":"`npm-library`","id":"npm-library","depth":2,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":2,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":2,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":2,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":2,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":835}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":48,"title":"dev","content":"#\n\n本章节描述了 Modern.js Module 关于调试工具相关的所有配置。\n\n\nstorybook#\n\nWARNING\n\nDeprecated:该配置已过时,只适用于 StorybookV6,详情请看使用Storybook。\n\n\nstorybook.webpack#\n\n * 类型:object | Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpack 来修改 Storybook Preview-iframe 的 webpack 配置。使用方式可以参考\nModern.js Builder 的 tools.webpack 配置。\n\n\n\n配置 Manager App#\n\n对于 Storybook Manager App 部分的 webpack 配置,可以通过增加 ./config/storybook/main.js\n文件进行配置。\n\n\n\n\nstorybook.webpackChain#\n\n * 类型:Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpackChain 来修改 Storybook Preview-iframe 的 webpack\n配置。使用方式可以参考 Modern.js Builder 的 tools.webpackChain 配置。","routePath":"/module-tools/api/config/dev","lang":"zh","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":43},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":118},{"text":"配置 Manager App","id":"配置-manager-app","depth":4,"charIndex":314},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":417}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":49,"title":"plugins","content":"#\n\n本章介绍注册 Modern.js Module 插件的配置。\n\n * 类型:ModuleToolsPlugin[]\n * 默认值:undefined\n\n\n插件执行顺序#\n\n默认情况下,自定义插件会按照 plugins 数组的顺序依次执行,Modern.js Module 内置插件的执行时机早于自定义插件。\n\n当插件内部使用了控制顺序的相关字段,比如 pre、post 时,会基于声明的字段对执行顺序进行调整,详见 插件之间的关系。\n\n\n开发插件#\n\n关于如何编写插件,可以查看「插件编写指南」。\n\n\n示例#\n\n\n使用 npm 上的插件#\n\n使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。\n\n\n\n使用本地插件#\n\n使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。\n\n\n\n\n插件配置项#\n\n如果插件提供了一些自定义的配置项,你可以通过插件函数的参数传入配置。\n\n","routePath":"/module-tools/api/config/plugins","lang":"zh","toc":[{"text":"插件执行顺序","id":"插件执行顺序","depth":2,"charIndex":79},{"text":"开发插件","id":"开发插件","depth":2,"charIndex":221},{"text":"示例","id":"示例","depth":2,"charIndex":253},{"text":"使用 npm 上的插件","id":"使用-npm-上的插件","depth":3,"charIndex":259},{"text":"使用本地插件","id":"使用本地插件","depth":4,"charIndex":316},{"text":"插件配置项","id":"插件配置项","depth":3,"charIndex":364}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":50,"title":"概览","content":"#","routePath":"/module-tools/api/","lang":"zh","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"概览","sidebar_position":1},"version":""},{"id":51,"title":"Plugin Hooks","content":"#\n\n本章介绍关于 Modern.js Module 支持的生命周期钩子。\n\n目前主要包含以下几类生命周期钩子:\n\n * 配置钩子:用于处理用户配置。\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n这里详细解释了 Hook 模型\n\n\n配置钩子#\n\n\nresolveModuleUserConfig#\n\n用于修改用户配置。\n\n类型:AsyncWaterfall\n\n\n\n\n构建钩子#\n\n在执行 build 命令的时候,会按照顺序触发以下 Hooks:\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\n执行整体构建流程之前触发。\n\n类型:ParallelWorkflow\n\n\n\n参数类型:\n\n\n\n> BuildConfig 类型参考 API 配置\n\n\nbeforeBuildTask#\n\n根据构建配置,Modern.js Module 会将整体构建分成多个子构建任务。该 Hook 将会在每一个构建子任务之前触发。\n\n类型:AsyncWaterfall\n\n\n\n\nafterBuildTask#\n\n类型:ParallelWorkflow,每一个构建子任务结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nafterBuild#\n\n类型:ParallelWorkflow,整体构建流程结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nbuildPlatform 钩子#\n\nmodule-tools 还提供了 build --platform 命令来执行特定的构建任务。\n\n例如在安装了 Doc 插件后,就可以执行 build --platform 或者 build --platform doc 来执行 doc 的构建任务。因为\ndoc 插件基于 buildPlatform Hooks 实现了该功能。\n\n在执行 build --platform 后会按照以下顺序触发 Hooks:\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\n获取在执行 build --platform 命令时候需要运行的任务信息。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。beforeBuildPlatform 会在执行整体的构建任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。buildPlatform 会在每个构建任务执行之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。afterBuildPlatform 会在整体 platform\n构建任务结束后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n调试钩子#\n\n在执行 dev 命令的时候,会按照顺序触发以下 Hooks:\n\n * registerDev: 在获取调试功能信息的时候触发。\n * beforeDev: 开始执行调试整体流程之前触发。\n * beforeDevMenu: 出现调试列表/菜单之前触发。\n * afterDevMenu: 选择调试列表/菜单选项后触发。\n * beforeDevTask: 执行调试任务之前触发。\n * afterDev: 执行 dev 整体流程最后触发。\n\n\nregisterDev#\n\n注册调试工具相关的数据。主要包含:\n\n * 调试工具的名称\n * 显示在菜单列表中的项目名称以及对应的值。\n * dev 子命令的定义。\n * 是否在运行调试任务之前执行源码构建\n * 执行调试任务的函数。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDev#\n\n在收集完所有调试工具元数据后,执行 dev 任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu 在出现调试列表/菜单之前触发。接收 inquirer question 作为参数。默认值为:\n\n\n\nafterDevMenu 选择调试列表/菜单选项后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDevTask#\n\n执行调试任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterDev#\n\n在中断调试任务进程时触发。\n\n","routePath":"/module-tools/api/plugin-api/plugin-hooks","lang":"zh","toc":[{"text":"配置钩子","id":"配置钩子","depth":2,"charIndex":209},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"构建钩子","id":"构建钩子","depth":2,"charIndex":276},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform 钩子","id":"buildplatform-钩子","depth":2,"charIndex":713},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"调试钩子","id":"调试钩子","depth":2,"charIndex":1459},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":52,"title":"","content":"","routePath":"/module-tools/components/faq-build-exception","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":53,"title":"","content":"","routePath":"/module-tools/components/faq-build-other","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":54,"title":"","content":"","routePath":"/module-tools/components/faq-build-product","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":55,"title":"","content":"","routePath":"/module-tools/components/faq-storybook","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":56,"title":"","content":"","routePath":"/module-tools/components/publish-emo","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":57,"title":"","content":"在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。","routePath":"/module-tools/components/register-esbuild-plugin","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":58,"title":"","content":"","routePath":"/module-tools/components/release-module-doc","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":59,"title":"处理静态资源","content":"#\n\nModern.js Module 会对代码中使用的静态资源进行处理。如果需要配置,则可以使用 buildConfig.asset API。\n\n\n默认行为#\n\n默认情况下,Modern.js Module 会处理以下静态资源:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\n对于静态文件的处理,Modern.js Module 目前默认支持的功能有:\n\n * 输出静态资源至 ./assets。\n * 对于不超过 10kb 的文件会内联到代码中。\n\n\n示例#\n\n让我们看下面的例子:\n\n * 项目源代码:\n\n\n\n * 如果 bg.png 的大小小于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n * 如果 bg.png 的大小大于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n当你想要修改默认行为的时候,可以使用以下 API:\n\n * asset.path:修改静态资源文件输出路径。\n * asset.limit:修改内联静态资源文件的阈值。","routePath":"/module-tools/guide/advance/asset","lang":"zh","toc":[{"text":"默认行为","id":"默认行为","depth":2,"charIndex":74},{"text":"示例","id":"示例","depth":2,"charIndex":355}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":60,"title":"构建 umd 产物","content":"#\n\numd 全称为 Universal Module Definition,这种格式的 JS 文件可以运行在多个运行环境:\n\n * 浏览器环境:基于 AMD 规范进行模块加载\n * Node.js 环境:基于 CommonJS 进行模块加载\n * 其他情况:将模块挂载在全局对象上。\n\n因此我们可以通过下面的方式,将项目的构建产物指定为 umd 产物:\n\n\n\n\numd 产物的第三方依赖处理#\n\n在 「如何处理第三方依赖」 章节中,我们知道可以通过 autoExternals 和 externals API 来控制项目是否对第三方依赖打包。 因此在构建\numd 产物的过程中,我们也可以这样使用:\n\n\n示例#\n\n * 如果项目依赖了 react:\n\n\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时产物中不会将 react 代码打包到产物中:\n\n\n\n通过上面的例子我们知道,当使用 autoExternal 和 externals API 后:\n\n * 在 Node.js 环境下,可以通过 require('react') 获取 react 依赖。\n * 在 浏览器环境下,可以通过 global.react 获取 react 依赖。\n\n\n三方依赖的全局变量名称#\n\n然而在浏览器环境下,获取第三方依赖的时候,全局变量名称不一定与依赖名称完全相同,此时就要使用 buildConfig.umdGlobals API。\n\n还是使用之前的例子,当 react 依赖以 windows.React 或者 global.React 全局变量的形式存在于浏览器环境下,那么此时:\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时我们会看到这样的产物代码:\n\n\n\n此时项目就可以运行在浏览器中,并使用存在于全局对象上的 React 变量了。\n\n\n更改项目的全局变量名称#\n\n当我们将下面的代码打包成 umd 产物并运行在浏览器的时候,我们可以通过 window.index 来使用该模块。\n\n\n\n默认情况下,以源码文件名称作为该模块在浏览器里全局变量的名称。对于上面的例子,其产物内容如下:\n\n\n\n如果需要修改它,则需要使用 buildConfig.umdModuleName API。\n\n当使用该 API 后:\n\n\n\n此时构建产物的内容为:\n\n","routePath":"/module-tools/guide/advance/build-umd","lang":"zh","toc":[{"text":"umd 产物的第三方依赖处理","id":"umd-产物的第三方依赖处理","depth":2,"charIndex":181},{"text":"示例","id":"示例","depth":3,"charIndex":302},{"text":"三方依赖的全局变量名称","id":"三方依赖的全局变量名称","depth":3,"charIndex":556},{"text":"更改项目的全局变量名称","id":"更改项目的全局变量名称","depth":2,"charIndex":836}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":61,"title":"使用 Copy 工具","content":"#\n\nModern.js Module 提供了 Copy 工具用于将已经存在的单个文件或整个目录复制到产物目录中。接下来我们学习如何使用它。\n\n\n了解 Copy API#\n\n我们可以通过 buildConfig.copy API 来使用 Copy 工具,它包含以下两个主要配置:\n\n * patterns\n * options\n\n\nAPI 详解#\n\ncopy.patterns 用于寻找复制的文件以及配置输出的路径。\n\n其中 patterns.from 用于指定要复制的文件或者目录。它接收 Glob 形式字符串或具体路径。Glob 形式字符串是指 fast-glob\npattern-syntax。因此我们可以按照如下两种方式使用它:\n\n\n\npatterns.context 一般和 patterns.from 配合使用,默认情况下它的值与 buildConfig.sourceDir\n相同,因此我们可以按照如下方式指定 src/data.json 文件为要复制的文件:\n\n> 默认情况下,buildConfig.sourceDir 为 src\n\n\n\n当指定的文件不在源码目录的时候,可以修改 context 配置。例如指定项目目录下的 temp/index.html 为要复制的文件:\n\n\n\npatterns.to 用于指定复制文件的输出路径,默认情况下它的值为 buildConfig.outDir对应的值。因此我们按照如下方式将\nsrc/index.html 复制到 dist 目录下:\n\n\n\n当我们配置了 patterns.to 的时候:\n\n * 如果是相对路径,则该路径会相对于 buildConfig.outDir 计算出复制文件输出的绝对路径。\n * 如果是绝对路径,则会直接使用该值。\n\n最后 patterns.globOptions 用于配置寻找复制文件 globby 对象,其配置可参考:\n\n * globby.options\n\n\n不同场景使用示例#\n\n\n将文件复制文件#\n\n\n\n\n将文件复制到目录#\n\n\n\n\n从目录复制到目录#\n\n\n\n\n从目录到文件#\n\n\n\n\n使用 Glob#\n\n","routePath":"/module-tools/guide/advance/copy","lang":"zh","toc":[{"text":"了解 Copy API","id":"了解-copy-api","depth":2,"charIndex":72},{"text":"API 详解","id":"api-详解","depth":2,"charIndex":165},{"text":"不同场景使用示例","id":"不同场景使用示例","depth":2,"charIndex":826},{"text":"将文件复制文件","id":"将文件复制文件","depth":3,"charIndex":838},{"text":"将文件复制到目录","id":"将文件复制到目录","depth":3,"charIndex":851},{"text":"从目录复制到目录","id":"从目录复制到目录","depth":3,"charIndex":865},{"text":"从目录到文件","id":"从目录到文件","depth":3,"charIndex":879},{"text":"使用 Glob","id":"使用-glob","depth":3,"charIndex":891}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":62,"title":"处理三方依赖","content":"#\n\n一般来说,项目所需要的第三方依赖可以通过包管理器的 install 命令安装,在安装第三方依赖成功后,这些第三方依赖一般会出现在项目 package.json\n的 dependencies 和 devDependencies 下。\n\n\n\n\"dependencies\" 下的依赖通常来说是这个包运行所需的依赖, \"devDependencies\" 则代表着开发依赖。\n\n除了 \"dependencies\" 以外,\"peerDependencies\" 也可以声明在生产环境下运行所需要的依赖,此时会和它的宿主共享一份依赖。\n\n\n第三方依赖的默认处理#\n\n在 Modern.js Module 里,默认情况下不会对 \"dependencies\" 以及 \"peerDependencies\"\n下的第三方依赖进行打包处理。\n\n这是因为在安装 npm 包时,其 \"dependencies\" 也会被安装。不打包 \"dependencies\",可以减小包产物的体积。\n\n如果需要打包某些依赖,建议将它们从 \"dependencies\" 挪到 \"devDependencies\" ,这相当于对依赖进行 prebundle\n,可以减小依赖安装的体积。\n\n\n示例#\n\n如果项目依赖了 react:\n\n\n\n当源码中使用了 react 依赖:\n\n\n\n此时产物中不会包含 react 的代码:\n\n\n\n如果想要修改默认的处理方式,可以通过下面的 API 进行修改:\n\n * buildConfig.autoExternal\n\n\n排除指定第三方依赖#\n\n在上面我们提到了 buildConfig.autoExternal API 的用途,同时 buildConfig.externals\n可以实现对三方依赖更细微的处理。\n\n例如当我们需要仅对某些依赖不进行打包处理的时候,可以按照如下方式进行配置:\n\n> 一般这种情况,可能是某些依赖不适合进行打包处理。如果遇到这种情况,则可以按照下面的方式进行处理。\n\n","routePath":"/module-tools/guide/advance/external-dependency","lang":"zh","toc":[{"text":"第三方依赖的默认处理","id":"第三方依赖的默认处理","depth":2,"charIndex":264},{"text":"示例","id":"示例","depth":3,"charIndex":521},{"text":"排除指定第三方依赖","id":"排除指定第三方依赖","depth":2,"charIndex":652}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":63,"title":"深入理解构建","content":"#\n\n在 \"基础使用\" 的部分,我们已经知道可以通过 buildConfig 配置对项目的输出产物进行修改。buildConfig\n不仅描述了产物的一些特性,同时还为构建产物提供了一些功能。\n\nTIP\n\n如果你还不了解 buildConfig 的作用,请先阅读 修改输出产物。\n\n而在本章里我们将要深入理解某些构建配置的作用以及了解执行 modern build 命令的时候发生了什么。\n\n\nbundle / bundleless#\n\n那么首先我们来了解一下 bundle 和 bundleless。\n\n所谓 bundle 是指对构建产物进行打包,构建产物可能是一个文件,也有可能是基于一定的代码拆分策略得到的多个文件。\n\n而 bundleless 则是指对每个源文件单独进行编译构建,但是并不将它们打包在一起。每一个产物文件都可以找到与之相对应的源码文件。bundleless\n构建的过程,也可以理解为仅对源文件进行代码转换的过程。\n\n它们有各自的好处:\n\n * bundle 可以减少构建产物的体积,也可以对依赖预打包,减小安装依赖的体积。提前对库进行打包,可以加快应用项目构建的速度。\n * bundleless 则是可以保持原有的文件结构,更有利于调试和 tree shaking。\n\nWARNING\n\nbundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 type 字段, 例如 import type { A } from\n'./types,背景参考 esbuild 文档。\n\n在 buildConfig 中可以通过 buildConfig.buildType 来指定当前构建任务是 bundle 还是 bundleless。\n\n\ninput / sourceDir#\n\nbuildConfig.input 用于指定读取源码的文件路径或者目录路径,其默认值在 bundle 和 bundleless 构建过程中有所不同:\n\n * 当 buildType: 'bundle' 的时候,input 默认值为 src/index.(j|t)sx?\n * 当 buildType: 'bundleless' 的时候,input 默认值为 ['src']\n\n从默认值上我们可以知道:使用 bundle 模式构建时一般指定一个或多个文件作为构建的入口,而使用 bundleless\n构建则是指定一个目录,将目录下所有文件作为入口。\n\nsourceDir 用于指定源码目录,它只与以下两个内容有关系:\n\n * 类型文件生成\n * 指定构建过程中的 outbase\n\n因此我们可以得到其最佳实践:\n\n * 在 bundle 构建过程中,只能指定 input 。\n * 一般情况下,bundleless 只需要指定 sourceDir(此时 input 会与 sourceDir 保持一致)。\n\n如果我们想要在 bundleless 里只对一部分文件进行转换,例如只需要转换 src/runtime 目录的文件,此时需要配置 input:\n\n\n\n\n使用 swc#\n\n在部分场景下,esbuild 不足以满足我们的需求,此时我们会使用 swc 来做代码转换。\n\n从 2.36.0 版本开始,涉及到以下功能时,Modern.js Module 默认会使用 swc ,但不这意味着不使用 esbuild 了,其余功能还是使用\nesbuild:\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\n事实上,我们在 2.16.0 版本开始全量使用 swc 进行代码转换。不过 swc 同样也存在一些限制,为此我们添加了 sourceType 配置,当源码格式为\n'commonjs' 时关闭 swc, 但这种方式并不符合用户直觉,另外,swc 格式化输出的 cjs 模式没有给每个导出名称添加注释,这在 node\n中使用可能会带来一些问题。 因为我们废弃了此行为,回到了最初的设计 - 只在需要的场景下使用 swc 作为补充。\n\n\n使用 Hook 介入构建流程#\n\nModern.js Module 提供了 Hook 机制,允许我们在构建流程的不同阶段注入自定义逻辑。 Modern.js Module Hook 使用了\ntapable 实现,扩展了 esbuild 的插件机制,若 esbuild plugins 已经满足了你的需求,建议直接使用它。 下面展开说明其用法:\n\n\nHook 类型#\n\nAsyncSeriesBailHook#\n\n串行执行的 hooks,如果某个 tapped function 返回非 undefined 结果,则后续其他的 tapped function 停止执行。\n\nAsyncSeriesWaterFallHooks#\n\n串行执行的 hooks,其结果会传递给下一个 tapped function\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * 在 esbuild onLoad callbacks 触发,根据模块路径来获取模块内容\n * 输入参数\n\n\n\n * 返回参数\n\n\n\n * 例子\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onLoad callbacks 触发, 将 load 阶段获取的模块内容进行转换\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onEnd callbacks 触发, 类似于 transform hook,但是作用在 esbuild 生成的产物\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\n\n类型文件生成#\n\nbuildConfig.dts 配置主要用于类型文件的生成。\n\n\n关闭类型生成#\n\n默认情况下类型生成功能是开启的,如果需要关闭的话,可以按照如下配置:\n\n\n\nTIP\n\n关闭类型文件后,一般来说构建速度会有所提升。\n\n\n打包类型文件#\n\n在 buildType: 'bundleless' 的时候,类型文件的生成是使用项目的 tsc 命令来完成生产。\n\nModern.js Module 同时还支持对类型文件进行打包,不过使用该功能的时候需要注意:\n\n * 对类型文件进行打包不会开启类型检查。\n * 一些第三方依赖存在错误的语法会导致打包过程失败。因此对于这种情况,需要手动通过 buildConfig.externals\n 将这类第三方包排除,或者直接关闭dts.respectExternal从而不打包任何三方包类型。\n * 对于第三方依赖的类型文件指向的是一个 .ts 文件的情况,目前无法处理。比如第三方依赖的 package.json 中存在这样的内容: {\"types\":\n \"./src/index.ts\"。\n\n对于上述问题,我们推荐的处理方式是首先使用 tsc 生成 d.ts 文件,然后将 index.d.ts 作为入口进行打包处理,并且关闭\ndts.respectExternal。在之后的演进我们也会逐渐向这种处理方式靠拢。\n\n\n别名转换#\n\n在 bundleless 构建过程中,如果源代码中出现了别名,例如:\n\n\n\n使用 tsc 生成的产物类型文件也会包含这些别名。不过 Modern.js Module 会对 tsc 生成的类型文件里的别名进行转换处理。\n\n\n一些示例#\n\n\n\n\n\n\n构建过程#\n\n当执行 modern build 命令的时候,会发生\n\n * 根据 buildConfig.outDir 清理产物目录。\n * 编译 js/ts 源代码生成 bundle / bundleless 的 JS 构建产物。\n * 使用 tsc 生成 bundle / bundleless 的类型文件。\n * 处理 copy 任务。\n\n\n构建报错#\n\n当发生构建报错的时候,基于以上了解到的信息,可以很容易的明白在终端出现的报错内容:\n\njs 或者 ts 构建的报错:\n\n\n\n类型文件生成过程的报错:\n\n\n\n对于 js/ts 构建错误,我们可以从报错信息中知道:\n\n * 报错的 buildType\n * 报错的 format\n * 报错的 target\n * 其他具体报错信息\n\n\n调试模式#\n\n从 2.36.0 版本开始,为了便于排查问题,Modern.js Module 提供了调试模式,你可以在执行构建时添加 DEBUG=module\n环境变量来开启调试模式。\n\n\n\n调试模式下,你会看到 Shell 中输出更详细的构建日志,这主要以流程日志为主:\n\n\n\n另外,Module 还提供了调试内部工作流程的能力。你可以通过设置环境变量 DEBUG=module:* 来开启更详细的调试日志:\n\n目前只支持了 DEBUG=module:resolve,可以查看 Module 内部模块解析的详细日志:\n\n","routePath":"/module-tools/guide/advance/in-depth-about-build","lang":"zh","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"使用 swc","id":"使用-swc","depth":2,"charIndex":1281},{"text":"使用 Hook 介入构建流程","id":"使用-hook-介入构建流程","depth":2,"charIndex":1762},{"text":"Hook 类型","id":"hook-类型","depth":3,"charIndex":1936},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":1946},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":2048},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":2117},{"text":"load","id":"load","depth":4,"charIndex":2128},{"text":"transform","id":"transform","depth":4,"charIndex":2236},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":2358},{"text":"类型文件生成","id":"类型文件生成","depth":2,"charIndex":2500},{"text":"关闭类型生成","id":"关闭类型生成","depth":3,"charIndex":2542},{"text":"打包类型文件","id":"打包类型文件","depth":3,"charIndex":2619},{"text":"别名转换","id":"别名转换","depth":3,"charIndex":3090},{"text":"一些示例","id":"一些示例","depth":3,"charIndex":3208},{"text":"构建过程","id":"构建过程","depth":2,"charIndex":3220},{"text":"构建报错","id":"构建报错","depth":2,"charIndex":3394},{"text":"调试模式","id":"调试模式","depth":2,"charIndex":3567}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":64,"title":"深入理解 dev 命令","content":"#\n\nModern.js Module 提供的 dev 命令主要用于代码的调试。\n\n\n命令运行的整体流程#\n\n 1. 当执行 dev 命令的时候,Modern.js Module 开始寻找是否存在可以执行的调试工具或者任务。调试工具或者任务就是类似 doc 这样的\n Modern.js Module 调试工具插件。\n 2. 当发现存在一个调试工具的时候,则会立即执行它。\n 3. 当发现多个调试工具的时候,则显示调试工具列表菜单。可以通过选择某个调试工具对应的名称选项启动它。\n 4. 当没有发现调试工具的时候,则告诉用户没有可用的调试工具。\n\n我们除了可以执行 dev 命令以外,也可以通过 dev [调试工具名称] 的方式来直接启动调试工具或者任务。\n\n\n扩展 dev 命令#\n\n如果需要扩展 dev 命令或者说提供自己的 Modern.js Module 调试工具插件,那么你需要先了解以下内容:\n\n * 开发插件\n * 调试工具插件 API\n\n一般来说,实现一个什么都不做的调试工具,其实现代码以及相关配置如下:\n\n\n\n如果需要使用该调试工具插件,则需要在配置文件中增加它:\n\n\n\n此时我们执行 dev 或者 dev do-nothing 命令的时候,就可以执行它了。在执行后,它会先执行监听模式的源码构建任务,并紧接着打印日志信息。\n\n对于目前官方支持的调试工具和第三方支持的调试工具,可以在插件列表中查看。","routePath":"/module-tools/guide/advance/in-depth-about-dev-command","lang":"zh","toc":[{"text":"命令运行的整体流程","id":"命令运行的整体流程","depth":2,"charIndex":42},{"text":"扩展 dev 命令","id":"扩展-dev-命令","depth":2,"charIndex":333}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":65,"title":"开始之前","content":"#\n\n\n环境准备#\n\n为了使用 Modern.js Module,首先需要 NodeJS,我们推荐最新的长期维护版本,并确保 Node 版本大于等于 16.0.0。因为非稳定的\nNodeJS 时常有一些 Bug,你可以使用 nvm-windows 和 nvm(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS\n版本,这些版本可能会用于不同的项目。\n\n\n初识 npm#\n\n当 NodeJS 被安装后,你不仅可以在命令行中访问 node 可执行程序,同时你也可以执行 npm 命令。\n\nnpm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript\n的工具。\n\n如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到「npm 包管理器」部分。\n\n\nnpm 包类型项目#\n\n那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 npm init 命令的时候,它会在当前目录下面创建一个文件名为 package.json\n的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 package.json\n文件中找到:\n\n\n\n此时这个包含了初始化后的 package.json 文件的项目就是一个 npm 包类型的项目,你可以执行 npm publish 命令将这个项目发布到 npm\nRegistry。\n\nnpm Registry 是一个 npm 包存储的地方,开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm\nRegistry 使用其他开发者发布的 npm 包。\n\n优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。\n\n\n使用第三方 npm 包#\n\n当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情\n—— npm 依赖的软件包类型:\n\n * \"dependencies\":一种是你的应用程序在生产环境中需要的软件包。\n * \"devDependencies\":另一种是仅在本地开发和测试中需要的软件包。\n \n > 软件包可以理解为是第三方的 npm 包。\n\n你可以通过执行 npm install npm-package-name 或者 npm add npm-package-name\n的方式来安装在生产环境中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在 \"dependencies\"\n里,并执行 npm install 命令:\n\n\n\n同理,你也可以执行 npm install npm-package-name --save-dev 或 npm add npm-package-name\n--save-dev 的方式来安装仅在本地开发和测试中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在\n\"devDependencies\" 里,并执行 npm install 命令:\n\n\n\n在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 \"dependencies\" 还是\n\"devDependencies\" 中。\n\nTIP\n\n一般来说,需要在源代码中使用到的包都属于 dependencies 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为\ndevDependencies 依赖。\n\n\n还需要了解的 npm 零碎知识#\n\n\nnpm 包的程序入口#\n\n在 package.json 中存在一个 \"main\" 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。\n\n例如你的包名为 foo,并且用户安装了它,然后执行 require(\"foo\") 代码,那么 foo 这个 npm 包的 \"main\"\n字段对应的文件将会被导出。\n\n推荐在你的 npm 包里一定要设置 \"main\" 字段。如果没有设置 \"main\",则默认入口为包的根目录下的 index.js 文件。\n\n除了需要设置 \"main\" 属性以外,一般还会设置 \"module\" 属性。它与 \"main\" 属性的用途类似,它主要是用于在 webpack\n场景下使用。webpack 在大多数情况下,会以 \"module\" -> \"main\" 这个顺序读取 npm 包的入口(文件)。\n\n> 想要了解关于 webpack 如何做这件事,可以查看这个链接。\n\n\n\"scripts\"#\n\npackage.json 文件的 \"scripts\" 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。\n\n这些都可以通过运行 npm run-script 或简称 npm run 来执行。\n\n名称匹配的前置命令和后置命令也会被运行(例如 premyscript、myscript、postmyscript)。\n\n\n\n当执行 npm run myscripts 的时候,premyscripts 对应的脚本会在它之前执行,postmyscripts 对应的脚本会在它之后执行。\n\n来自依赖的脚本命令可以用 npm explore -- npm run 运行。\n\n还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。\n\nnpm install#\n\n当你运行 npm install -g 时,以下脚本会运行。\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\n如果你的软件包根目录有一个 binding.gyp 文件,而你没有定义 install 或 preinstall 脚本,那么 npm 将以 node-gyp\nrebuild 作为默认的 install 命令,使用 node-gyp 进行编译。\n\nnpm publish#\n\n当发布项目的时候,执行该命令会触发以下脚本:\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\n当以 --dry-run 模式运行的时候,prepare 对应的脚本将不会执行。\n\n\npeerDependencies#\n\n在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm\n项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm\n项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。\n\n关于更多 peerDependencies 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:\n\n * npm 对 peerDependencies 的解释\n * pnpm vs npm VS Yarn\n\n\nnpm 包管理器#\n\n除了 npm 这种标准的包管理器以外,目前主流的还有 pnpm 和 Yarn,它们都是不错的 npm cli 替代品。\n\n推荐使用 pnpm 来管理项目依赖,可以通过下面的方式安装它:\n\n\n\n\nModern.js Module 配置文件#\n\n通过 @modern-js/create 创建的项目目录下提供了 Modern.js Module 的配置文件 ——\nmodern.config.(j|t)s。但 modern.config 配置文件不是必须存在的。\n\n默认情况下,生成的配置文件的内容如下:\n\n\n\n我们推荐使用 defineConfig 函数,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:\n\n","routePath":"/module-tools/guide/basic/before-getting-started","lang":"zh","toc":[{"text":"环境准备","id":"环境准备","depth":2,"charIndex":3},{"text":"初识 npm","id":"初识-npm","depth":2,"charIndex":188},{"text":"npm 包类型项目","id":"npm-包类型项目","depth":2,"charIndex":391},{"text":"使用第三方 npm 包","id":"使用第三方-npm-包","depth":2,"charIndex":818},{"text":"还需要了解的 npm 零碎知识","id":"还需要了解的-npm-零碎知识","depth":2,"charIndex":1602},{"text":"npm 包的程序入口","id":"npm-包的程序入口","depth":3,"charIndex":1621},{"text":"\"scripts\"","id":"scripts","depth":3,"charIndex":2042},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":2825},{"text":"npm 包管理器","id":"npm-包管理器","depth":2,"charIndex":3139},{"text":"Modern.js Module 配置文件","id":"modernjs-module-配置文件","depth":2,"charIndex":3247}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":66,"title":"CLI 命令","content":"#\n\nModern.js Module 项目可以使用的 CLI 命令如下:\n\n\nmodern build#\n\n\n\nModern.js Module 支持 platform 构建模式,可以用于执行其他工具的构建任务,目前官方支持的有 Rspress。例如,可以通过执行\nmodern build --platform 命令启动 doc 构建任务生成 doc 产物。\n\n\nmodern new#\n\n\n\nmodern new 命令用于启动微生成器功能,它可以为项目启用默认没有提供的功能。\n\n目前可以开启的功能有:\n\n * Storybook V7\n * Tailwind CSS 支持\n * Modern.js Runtime API\n\n关于这些功能,可以通过「使用微生成器」 章节了解更多。\n\n\nmodern dev#\n\n\n\nModern.js Module 提供了使用调试工具的能力,可以通过 modern dev\n命令来启动。不过要注意的是,默认情况下是没有提供调试相关的插件,因此此时执行 modern dev 会提示: \"No dev tools found\navailable\"。\n\n目前官方支持的调试工具有 Rspress,因此在你执行 modern new 命令开启它后,就可以执行 modern dev 或者 modern dev doc\n执行它。\n\n\nmodern lint#\n\n\n\n运行 ESLint 检查代码语法情况。通常情况下,我们只需要在 git commit 阶段通过 lint-staged 检查本次提交修改的部分代码。\n\n * --no-fix 参数设置后可以关闭自动修复 lint 错误代码的能力。\n\n\nmodern change#\n\n\n\nmodern change 命令用于生成 changesets 需要的 Markdown 文件。\n\n\nmodern pre#\n\n\n\n可以使用 modern pre 命令在正式发布前预发布一个版本。\n\n\nmodern bump#\n\n\n\n按照 changesets 生成的变更记录的 Markdown 文件修改 package.json 中的版本号, 同时生成 CHANGELOG.md 文件。\n\n\nmodern release#\n\n\n\nmodern release 命令可以将模块发布到 npm Registry 上。\n\n * --tag 参数可以指定发布时具体的 dist tags。\n\n\nmodern gen-release-note#\n\n\n\n根据当前仓库的 changeset 信息自动生成 Release Note。\n\nTIP\n\n需要在 bump 命令之前执行。\n\n\nmodern upgrade#\n\n\n\nmodern upgrade 命令,用于升级项目 Modern.js 相关依赖至最新版本。\n\n在项目根目录下执行命令 npx modern upgrade,会默认将当前执行命令项目的 package.json 中的 Modern.js\n相关依赖更新至最新版本。","routePath":"/module-tools/guide/basic/command-preview","lang":"zh","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":67,"title":"修改输出产物","content":"#\n\n\n默认输出产物#\n\n当你在初始化的项目里使用 modern build 命令的时候,Modern.js Module 会根据当前配置内容,生成相应的构建产物。\n\n模板创建的默认配置内容如下:\n\n\n\n默认生成产物具有以下特点:\n\n * 会生成 CommonJS 和 ESM 两份产物。\n * 代码语法支持到 ES6 ,更高级的语法将会被转换。\n * 所有的代码经过打包变成了一个文件,即进行了 bundle 处理。\n * 产物输出根目录为项目下的 dist 目录,类型文件输出的目录为 dist/types。\n\n看到这里你可能会有以下疑问:\n\n 1. buildPreset 是什么?\n 2. 产物的这些特点是由什么决定的?\n\n接下来,我们首先来了解一下 buildPreset。\n\n\n构建预设#\n\nbuildPreset 代表着提前准备好的一组或者多组构建相关的配置,只需要使用 buildPreset\n对应的预设值,就可以省去麻烦且复杂的配置工作,得到符合预期的产物。\n\nModern.js Module 主要内置了两套构建预设,包括:\n\n * npm-component: 用于构建组件库。\n * npm-library: 用于打包其他库类型的项目,如工具库。\n\n同时,还提供一些变体,例如 npm-library-with-umd 和 npm-library-es5,顾名思义,分别对应带有 umd 产物和支持到 es5\n语法的库预设。 详细配置可以查看其 API 。\n\n除此之外,我们也可以完全自定义构建配置:\n\n\n构建配置#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项。在最开始提到的关于“构建产物的特点”,其实都是 buildConfig\n所支持的属性。目前所支持的属性覆盖了大部分模块类型项目在构建产物时的需求,buildConfig\n不仅包含一些产物所具备的属性,也包含了构建产物所需要的一些特性功能。接下来从分类的角度简单罗列一下:\n\n构建产物的基本属性包括:\n\n * 产物是否被打包:对应的 API 是 buildConfig.buildType。\n * 产物对于语法的支持:对应的 API 是 buildConfig.target。\n * 产物格式:对应的 API 是 buildConfig.format。\n * 产物类型文件如何处理,对应的 API 是 buildConfig.dts。\n * 产物的 sourceMap 如何处理:对应的 API 是 buildConfig.sourceMap。\n * 产物对应的输入(或者是源文件):对应的 API 是 buildConfig.input。\n * 产物输出的目录:对应的 API 是 buildConfig.outDir。\n * 构建的源码目录:对应的 API 是 buildConfig.sourceDir。\n\n构建产物所需的常用功能包括:\n\n * 别名:对应的 API 是 buildConfig.alias。\n * 静态资源处理:对应的 API 是 buildConfig.asset。\n * 第三方依赖处理:对应的 API 有:\n * buildConfig.autoExternal。\n * buildConfig.externals。\n * 拷贝:对应的 API 是 buildConfig.copy。\n * 全局变量替换:对应的 API 是 buildConfig.define。\n * 指定 JSX 编译方式,对应的 API 是 buildConfig.jsx。\n\n一些高级属性或者使用频率不高的功能:\n\n * 产物代码压缩:对应的 API 是 buildConfig.minify。\n * 代码分割:buildConfig.spitting\n * 指定构建产物用于 NodeJS 环境还是浏览器环境:对应的 API 是 buildConfig.platform。\n * umd 产物相关:\n * 指定 umd 产物外部导入的全局变量:对应的 API 是 buildConfig.umdGlobals。\n * 指定 umd 产物的模块名:对应的 API 是 buildConfig.umdModuleName。\n\n除了以上分类以外,关于这些 API 的常见问题和最佳实践可以通过下面的链接来了解:\n\n * 关于 bundle 和 bundleless\n * 关于 input 和 sourceDir。\n * 关于类型描述文件。\n * 如何使用 define\n * 如何处理第三方依赖\n * 如何使用拷贝\n * 如何构建 umd 产物\n * 如何使用静态资源\n\n\n结合配置与预设#\n\n了解 buildPreset 和 buildConfig 之后,我们可以将二者进行结合使用。\n\n在实际项目中,我们可以先使用 buildPreset 来快速获取一套默认构建配置。如果需要自定义,可以使用 buildConfig 进行覆盖和扩展。\n\n扩展的逻辑如下:\n\n * 当 buildConfig 是数组时,会在原来的预设基础上添加新的配置项。\n\n\n\n这会在原本预设的基础上,额外生成一份 IIFE 格式、支持到 ES2020 语法的产物,输出目录为项目下的 dist/global 目录。\n\n * 当 buildConfig 是对象时,会将对象中的配置项覆盖到预设中。\n\n\n\n这会使得每一项构建任务都会生成 sourceMap 文件。","routePath":"/module-tools/guide/basic/modify-output-product","lang":"zh","toc":[{"text":"默认输出产物","id":"默认输出产物","depth":2,"charIndex":3},{"text":"构建预设","id":"构建预设","depth":2,"charIndex":344},{"text":"构建配置","id":"构建配置","depth":2,"charIndex":664},{"text":"结合配置与预设","id":"结合配置与预设","depth":2,"charIndex":1952}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":68,"title":"版本管理与发布","content":"#\n\n一个 npm 类型的模块项目发布流程包含了两个阶段:\n\n * 第一阶段是在开发期间,开发者需要提供变更文件,该文件记录了在发布期间需要的变更内容;\n * 第二阶段是在发布期间,需要收集所有的变更文件来更新版本、更新发布日志,并发布新的包到 npm Registry 上。\n\nModern.js Module 提供了一套版本管理与发布的方案,这适用于单包场景。对于 monorepo 里的 npm 包你需要遵循各类 monorepo\n解决方案提供的策略。\n\n\n跟踪变更#\n\n当项目发生变化的时候需要将变化的内容记录下来。项目发生的变化一般是指:\n\n * 新功能\n * 修复问题\n * 配置文件修改\n * ...\n\n当这些任务一旦开发完成后,需要通过以下命令来对当前的变化进行记录:\n\n * modern change\n\n执行 modern change 命令后会向开发者提出几个问题,并根据开发者的回答生成变更记录。变更记录文件包含了版本变化的类型和其描述,该文件会被提交到\ngit 仓库中。\n\n\n\n当执行成功后,生成的包含变更记录的 Markdown 文件会保存在项目的 .changeset 目录下面。其内容类似下面这样:\n\n\n\n\n版本更新#\n\n当需要更新项目版本的时候,执行以下命令:\n\n * modern bump\n\n执行 modern bump 将会基于 .changeset/ 目录下记录了变更的 Markdown 文件内容来修改 package.json\n中的版本号,同时生成 CHANGELOG.md 文件。而当版本更新完成后,这些记录变更的 Markdown 文件也会被删除,也可说这些 Markdown\n文件被“消耗”掉了。\n\n\n\n\n发布#\n\n发布项目可以执行以下命令:\n\n * modern release\n\nmodern release 命令可以将项目发布到 npm Registry。\n\n此时发布的是 latest 版本,也可以说是正式版本。如果想要修改 dist-tag,可以通过 modern release --tag 命令来指定。例如:\n\n\n\n但是如果希望将当前项目的版本号也修改为预发布的版本号,则需要使用 modern pre 命令。\n\n> 所谓 dist-tag,可以理解:为当前发布的版本打标签。一般来说,默认发布的版本对应的 dist-tag 为 latest,因此可以把 latest\n> 认为是正式版本的 dist-tag。\n\n\n预发布#\n\n当需要在正式发布之前进行预发布,则需要执行以下命令:\n\n * modern pre\n\n首先 modern pre enter 进入预发布模式, 可以与发布项目的时候使用 modern release --tag 命令指定的 tag 一致。\n\n\n\n接着可以使用 modern bump 命令更新具体的版本号,此时不会真正的“消耗”记录变更的 Markdown 文件:\n\n\n\n然后可以看到 package.json 中更新的版本号会类似这样:0.1.2-next.0。\n\n最后,如果不需要再进行预发布,则一定要执行 modern pre exit 命令,这样可以退出预发布状态,并且当再次执行 modern bump\n命令的时候,就可以发布正式的版本。","routePath":"/module-tools/guide/basic/publish-your-project","lang":"zh","toc":[{"text":"跟踪变更","id":"跟踪变更","depth":2,"charIndex":231},{"text":"版本更新","id":"版本更新","depth":2,"charIndex":519},{"text":"发布","id":"发布","depth":2,"charIndex":728},{"text":"预发布","id":"预发布","depth":2,"charIndex":1040}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":69,"title":"使用微生成器","content":"#\n\nModern.js Module 提供了微生成器工具,它可以为当前项目:\n\n * 新增目录和文件\n * 修改 package.json\n * 执行命令\n\n因此通过这些能力,微生成器可以为项目开启额外的特性功能。\n\n可以通过 modern new 启动微生成器。目前 Modern.js Module 支持的微生成器功能有:\n\n\n开发模块文档#\n\n当我们想要为模块编写文档的时候,可以启用模块文档功能。会在项目目录下创建 docs 目录以及相关文件,在 package.json 中新增\n\"@modern-js/plugin-rspress\" 依赖。 使用 modern dev 和 modern build --platform\n来调试和构建你的文档站点。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n\n\n\nStorybook 调试#\n\n当我们想要对组件或者普通模块进行调试的时候,可以启用 Storybook 调试功能。启动该功能后,会在项目目录下创建 stories 目录以及\n.storybook 目录,在 package.json 中新增 \"@modern-js/storybook\" 依赖。使用 storybook dev 和\nstorybook build 来调试和构建。\n\n\nTailwind CSS 支持#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\n如果你想要在项目使用 Tailwind CSS,可以参考 「使用 Tailwind CSS」。\n\n\nModern.js Runtime API 支持#\n\nModern.js 提供了 Runtime API 能力,这些 API 只能在 Modern.js 的应用项目环境中使用。如果你需要开发一个 Modern.js\n应用环境中使用的组件,那么你可以开启该特性,微生成器会增加 \"@modern-js/runtime\"依赖。\n\n另外,Storybook 调试工具也会通过检测项目的依赖确定项目是否需要使用 Runtime API,并且提供与 Modern.js 应用项目一样的\nRuntime API 运行环境。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n","routePath":"/module-tools/guide/basic/use-micro-generator","lang":"zh","toc":[{"text":"开发模块文档","id":"开发模块文档","depth":2,"charIndex":166},{"text":"Storybook 调试","id":"storybook-调试","depth":2,"charIndex":370},{"text":"Tailwind CSS 支持","id":"tailwind-css-支持","depth":2,"charIndex":561},{"text":"Modern.js Runtime API 支持","id":"modernjs-runtime-api-支持","depth":2,"charIndex":709}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":70,"title":"开发模块文档","content":"#\n\n本章介绍如何为模块项目快速搭建一个静态文档站点。\n\n\n开始之前#\n\n\n为什么我们需要为模块搭建一个文档站点#\n\n 1. 文档站点可以帮助我们更好地组织文档的结构。\n 2. 文档站点具有更好的表现形式,例如可以在页面中执行函数,渲染组件等。\n 3. 可以更好地利用 AI 搜索的能力。\n\n\n前置准备#\n\n 1. 通过微生成器开启文档功能。\n 2. 阅读Rspress 介绍。\n\n完成准备工作之后,接下来我们会基于 Rspress 为模块项目搭建一个文档站点。\n\n\n站点基本结构#\n\n站点整体布局由三部分组成:导航栏、侧边栏以及正文部分,其中正文还包括了 TOC(Table of contents found at the beginning\nof a book or document)。\n\nRspress 使用的是文件系统路由,模块文档基于此实现了侧边栏的自动生成。 例如,如果你有以下的文件结构:\n\n\n\n那么 foo/bar.md 的路由路径会是 /foo/bar,foo.md 的路由路径会是 /foo,index.md 的路由路径会是 /。\n\n具体映射规则如下:\n\n文件路径 路由路径\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\n与上述文件路径和路由路径依次对应的侧边栏如下所示:\n\n\n配置侧边栏#\n\n如上图所示,模块文档已经为文件系统路由自动生成了侧边栏,其中侧边栏每一栏的文本是由文件的一级标题或者目录名决定。 如果你需要自定义侧边栏,请使用\n_meta.json 或者直接配置 sidebar。\n\nINFO\n\n如果你的文档目录结构是符合国际化的,例如:\n\n\n\n你需要按照国际化章节,同时配置 lang 和 locales,否则模块自动生成的侧边栏不会处理 zh 和 en 这两个目录。\n\n\n编写文档#\n\n接下来我们可以专注于文档内容的编写了。除了最基本的编写 markdown 以外,你可能还需要了解以下进阶内容:\n\n * 使用 MDX\n * 使用静态资源\n\n\n组件预览#\n\n模块文档为组件库提供了预览能力,jsx和tsx的代码块里的内容将会被解析为 React 组件。\n\n\n示例#\n\n假设我们的项目名是demo,并导出了一个 Button 组件。\n\n 1. 首先新增 docs/Button.mdx 文件:\n\n\n\n 2. 在tsconfig.json里配置别名,将包名指向当前项目目录,使得文档开发者和用户使用组件方式一致:\n\n\n\n 3. 在 .gitignore 文件下添加 doc_build/,文档产物将会生成在此目录下:\n\n\n\n恭喜你,已经完成了一个组件文档的编写,执行pnpm run dev看看效果吧,记得先构建一下组件库,确保组件产物存在。\n\n\n移动端预览#\n\n同时,我们也支持了移动端预览的方式,即使用 iframe 渲染移动端组件,并可以通过 iframePosition 设置 iframe\n的位置,支持扫码预览以及新页面打开。\n\n\n\nTIP\n\n如果只想要改变某一个 jsx 和 tsx 代码块的预览方式,可以使用不同的修饰符进行标识:\n\n\n\n\n使用外部 demo#\n\n如果我们的 demo 非常复杂,那么建议单独编写 demo,然后在 MDX 中使用 code 标签:\n\n\n\n这同样支持单独设置代码块的预览方式,例如:\n\n\n\n\n使用内置组件#\n\n插件内部实现了一部分内置组件,以便于你可以更轻松地开发模块文档。\n\n\nAPI#\n\n展示模块的 API 内容\n\n解析文件#\n\n在使用 API 组件之前,首先我们需要指定解析的文件:\n\n\n\n内容生成#\n\n接下来我们了解一下根据解析的文件会生成什么样的 markdown 内容。\n\n内容可以通过 react-docgen-typescript 或者 documentation 两个不同的工具生成:\n\n * react-docgen-typescript针对于组件库场景,仅会解析 props 生成表格。\n\n\n\n上面是一个标准写法,其中 ButtonProps 将被提取至表格中, Button 作为表格的标题。如果使用默认导出,文件名将作为表格标题。\n\n需要注意的是,export 导出事先定义的特性将不会被解析。\n\n\n\n生成的内容如下:\n\n\n\nWARNING\n\n如果 Props 里使用了 React 的类型,你需要在 tsconfig.json 里添加 types ,否则会解析不到 React 命名空间下的类型。\n\n\n\n更好的方式是直接引用类型,例如\n\n\n\n * documentation适用于工具库场景,用来解析 JSDoc 注释。\n\n\n\n上面是一个带有 JSDoc 注释的 greet 函数。生成的内容如下:\n\n\n\n组件使用#\n\n接下来,你便可以在文档里使用我们的内置 API 组件了,将key值传入moduleName属性里\n\n\n\n\nOverview#\n\n展示模块列表,可以放在首页用来展示所有模块。\n\nOverview 组件只有一个 list 属性,接收一个对象数组,下面是对象的属性\n\n属性 说明 类型 默认值\nicon 图标 React.ReactNode \ntext 文本(必填) string \nlink 链接(必填) string \narrow 是否展示箭头 boolean false\n\n\n插件配置#\n\n\napiParseTool#\n\nAPI 解析工具\n\n * 类型:'react-docgen-typescript' | 'documentation'\n * 默认值:'react-docgen-typescript'\n\n\ndoc#\n\n文档框架配置\n\n\nentries#\n\n自动生成文档的模块名称及相对路径\n\n * 类型:Entries | ToolEntries\n * 默认值:{}\n\n\n\nEntries 同时支持针对不同的文件使用不同的解析工具:\n\n\n\n\niframePosition#\n\niframe 所处页面位置\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nfollow时,每一个代码块都会有一个 iframe 展示其渲染视图。 fixed时,iframe 将会固定在页面右侧,展示当前页面所有代码块的视图。\n\n\nparseToolOptions#\n\nAPI 解析工具的参数\n\n * 类型:ParseToolOptions\n * 默认值:{}\n\n\n\n\npreviewMode#\n\n代码块预览方式。\n\n * 类型:'internal' | 'iframe'\n * 默认值: 'internal'\n\ninternal时,代码块内容将会直接渲染在页面中,反之将会通过 iframe 加载。\n\n\ndeprecated: languages#\n\nWARNING\n\n从 2.44.0 版本开始,请参考 国际化 章节来实现多语言。\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\n从 2.44.0 版本开始,内部实现了嗅探机制,请直接使用 _meta.json 或者直接配置 sidebar 来实现自定义侧边栏。\n\n\n命令行#\n\n * modern dev: 启动文档站本地开发。\n * modern build --platform: 构建生产环境产物。\n\n\n进阶指南#\n\n以上已经介绍完了开发模块文档的基本内容,但是这对于开发一个完整的文档站是不够的。查看Rspress以深入了解我们的文档框架。 你可以通过 doc\n配置来修改文档框架配置。\n\n","routePath":"/module-tools/guide/basic/use-module-doc","lang":"zh","toc":[{"text":"开始之前","id":"开始之前","depth":2,"charIndex":29},{"text":"为什么我们需要为模块搭建一个文档站点","id":"为什么我们需要为模块搭建一个文档站点","depth":3,"charIndex":37},{"text":"前置准备","id":"前置准备","depth":3,"charIndex":146},{"text":"站点基本结构","id":"站点基本结构","depth":2,"charIndex":233},{"text":"配置侧边栏","id":"配置侧边栏","depth":3,"charIndex":625},{"text":"编写文档","id":"编写文档","depth":2,"charIndex":830},{"text":"组件预览","id":"组件预览","depth":2,"charIndex":916},{"text":"示例","id":"示例","depth":3,"charIndex":973},{"text":"移动端预览","id":"移动端预览","depth":3,"charIndex":1216},{"text":"使用外部 demo","id":"使用外部-demo","depth":3,"charIndex":1369},{"text":"使用内置组件","id":"使用内置组件","depth":2,"charIndex":1461},{"text":"API","id":"api","depth":3,"charIndex":1505},{"text":"解析文件","id":"解析文件","depth":4,"charIndex":1525},{"text":"内容生成","id":"内容生成","depth":4,"charIndex":1563},{"text":"组件使用","id":"组件使用","depth":4,"charIndex":2032},{"text":"Overview","id":"overview","depth":3,"charIndex":2092},{"text":"插件配置","id":"插件配置","depth":2,"charIndex":2360},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":2368},{"text":"doc","id":"doc","depth":3,"charIndex":2478},{"text":"entries","id":"entries","depth":3,"charIndex":2493},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":2596},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":2749},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":2818},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":2936},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":3003},{"text":"命令行","id":"命令行","depth":2,"charIndex":3112},{"text":"进阶指南","id":"进阶指南","depth":2,"charIndex":3184}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":71,"title":"使用 Storybook","content":"#\n\nStorybook 是一个专门用于组件调试的工具,它围绕着组件开发提供了:\n\n * 丰富多样的调试能力\n * 可与一些测试工具结合使用\n * 可重复使用的文档内容\n * 可分享能力\n * 工作流程自动化\n\n在使用 Storybook 时,难免会遇到各种配置问题,需要手动配置 Babel 插件,手动配置 Webpack 去支持 less,sass 等。\nModern.js 集成了 Storybook,这对于我们开发 Storybook 项目来说极大地简化了配置工作。\n\n\nV7 (推荐)#\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建配置文件夹 .storybook,以及默认配置文件 .storybook/main.ts\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @storybook/addon-essential 和 @modern-js/storybook,以及创建\n storybook 相关脚本。\n\n\n开启产物调试#\n\n事实上,Modern.js Module 是基于 esbuild 实现的,而 Storybook 使用 Webpack\n作为默认构建工具,二者的配置无法完全兼容, 所以这里我们推荐先对组件进行构建,然后在 stories 里引入组件产物。\n\n引入组件产物的方式非常简单,假设你的模块导出了一个 Button 组件,那么在 stories 里可以这样使用:\n\n\n\n如果想要更新组件,则可以在启动 Storybook 前启动监听模式的构建:\n\n\n\nINFO\n\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:\n\n对于 pnpm 的项目,可以按照下面的内容对 package.json 进行修改:\n\n\n\n> 关于 pnpm 的 publishConfig 的使用,可以阅读下面这个链接。\n\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在开发阶段和发布阶段对 package.json 的 types 的值进行修改。\n\n\n开启 Rspack 构建#\n\nRspack 构建速度非常快,只需要如下配置即可使用 Rspack 作为构建工具。\n\n\n\n注意上面配置中,更改了 reactDocgen 配置,因为 Rspack 目前还不支持\n@storybook/react-docgen-typescript-plugin。\n\n\n配置#\n\n在 .storybook/main.js 中包含一些独有的配置。\n\nbundler#\n\n * 类型: 'webpack' | 'rspack'\n * 默认值: webpack\n\n指定底层打包工具使用 Webpack 还是 Rspack。\n\n\n\nbuilderConfig#\n\n * 类型: BuilderConfig\n * 默认值: undefined\n\nModern.js 的 Storybook 构建能力由 Rsbuild 提供,可通过 builderConfig 修改 Rsbuild 构建配置。\n\n\n\n\n命令行#\n\n@modern-js/storybook 代理了部分 storybook cli 的命令。\n\nstorybook dev#\n\n启动 Storybook,查看详情\n\nstorybook build#\n\n对 Storybook 进行生产环境构建,查看详情\n\n\n配置文件#\n\n配置文件中除了 Rsbuild 配置还包含一个额外的字段,builderPlugins,方便使用 Rsbuild 插件,例如启用 SWC 编译。\n\n\n\n\n从 V6 迁移至 V7#\n\n我们对于两个版本的支持方式不同,因此如果你是从 V6 迁移至 V7 的用户,我们希望你也按上述方式使用 V7,同时做以下调整:\n\n * 配置文件:将原来 root/config/storybook/main.(j|t)s 里的自定义配置(如果有)迁移到新的\n root/.storybook/main.(j|t)s。\n * 依赖:升级 @storybook/addon-* 系列依赖(如果有)到 7 版本,并删除 @modern-js/plugin-storybook 依赖。\n * 命令: 将原来 edenx dev storybook 和 edenx build --platform 命令删除,如果习惯了原来的 pnpm run\n dev 的调用方式,可以 将其替换成 storybook dev -p 6006 和 storybook build。\n * modern.config.(j|t)s : 删除 @modern-js/plugin-storybook 插件的注册。\n\n\nV6 (legacy)#\n\n从 2.40.0 版本开始,@modern-js/plugin-storybook将停止迭代。建议使用 V7 版本。 如果你的\n@modern-js/module-tools 版本低于 2.40.0,可以按照以下方式使用 Storybook V6:\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @modern-js/plugin-storybook,以及添加 pnpm dev storybook\n 等相关脚本。\n\n\n配置 Storybook#\n\nStorybook 官方通过一个名为 .storybook 的文件夹来进行项目配置,其中包含各种配置文件。在 Modern.js Module 中,可以在项目的\nconfig/storybook 目录下增加 Storybook 配置文件。\n\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\n\n * Configure Storybook\n\n不过这在模块项目里使用时存在一些限制:\n\n * 不能修改 Story 文件存放的位置,即无法在 main.js 文件里修改 stories 配置。\n * 不能修改 Webpack 和 Babel 相关的配置,即无法在 main.js 文件里修改 webpackFinal 和 babel 配置。\n\n\n构建 Storybook 产物#\n\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\n\n\n\n构建完成后,可以在 dist/storybook-static 目录看到构建产物文件。","routePath":"/module-tools/guide/basic/using-storybook","lang":"zh","toc":[{"text":"V7 (推荐)","id":"v7-推荐","depth":2,"charIndex":239},{"text":"开启 Storybook","id":"开启-storybook","depth":3,"charIndex":250},{"text":"开启产物调试","id":"开启产物调试","depth":3,"charIndex":492},{"text":"开启 Rspack 构建","id":"开启-rspack-构建","depth":3,"charIndex":946},{"text":"配置","id":"配置","depth":3,"charIndex":1095},{"text":"bundler","id":"bundler","depth":4,"charIndex":1134},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":1222},{"text":"命令行","id":"命令行","depth":3,"charIndex":1356},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":1409},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":1444},{"text":"配置文件","id":"配置文件","depth":3,"charIndex":1490},{"text":"从 V6 迁移至 V7","id":"从-v6-迁移至-v7","depth":2,"charIndex":1574},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":2037},{"text":"开启 Storybook","id":"开启-storybook-1","depth":3,"charIndex":2178},{"text":"配置 Storybook","id":"配置-storybook","depth":3,"charIndex":2358},{"text":"构建 Storybook 产物","id":"构建-storybook-产物","depth":3,"charIndex":2705}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":72,"title":"开发组件","content":"#\n\n本章将要介绍如何使用 Modern.js Module 开发组件项目。\n\n\n初始化项目#\n\n 1. 推荐使用 @modern-js/create 命令来初始化一个 npm 项目。\n\n\n\n 2. 初始化的目录结构如下:\n\n\n\n 3. 最后修改 ./src/index.ts 文件后缀和内容如下,就完成了组件项目的初始化。\n\n\n\n\n使用 Storybook 调试代码#\n\n请参考 「使用 Storybook」 来使用 Storybook 调试代码。\n\n\n开发样式#\n\n接下来我们可以给组件添加样式。\n\n目前支持开发样式的能力有:\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module 支持 PostCSS,并且内置了以下 PostCSS 插件:\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\n因此我们可以在项目中创建 .css 文件,并且可以直接在 css 文件中使用这些插件提供的语法支持和能力。\n\n * 源代码:\n\n\n\n * CSS 产物:\n\n\n\n\nLess#\n\nModern.js Module 支持使用 Less 开发样式。\n\n> 目前内置的 Less 版本为 v4.1.3\n\n * 源代码:\n\n\n\n * Less 产物:\n\n\n\n\nSass/Scss#\n\nModern.js Module 支持使用 Scss/Sass 开发样式。\n\n> 目前内置的 Sass 版本为 v1.54.4\n\n * 源代码:\n\n\n\n * Sass 产物:\n\n\n\n\nTailwind CSS#\n\n请参考 「使用 Tailwind CSS」 来了解相关用法。\n\n\nCSS Modules#\n\nModern.js Module 支持使用 CSS Module 开发样式。默认情况下会将以下文件识别为 CSS Module 文件:\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\n如果需要对 CSS Modules 进行配置,可以查看以下 API:\n\n * style.autoModules\n * style.modules\n\n下面是一个代码示例:\n\n\n\n\n\n\n配置构建产物#\n\n根据组件项目使用的多数场景,推荐使用 npm-component 构建预设。该预设得到的产物目录结构为:\n\n\n\n * ./dist/es: 包含了支持 es6 语法的 ES modules 格式的 bundleless 产物。\n * ./dist/lib: 包含了支持 es6 语法的 CommonJS 格式的 bundleless 产物。\n * ./dist/types: 包含了类型文件。\n\n如果对使用语法支持有要求,可以手动配置 buildPreset,并且支持在 npm-component 基础上增加后缀的方式修改支持的语法:\n\n\n\n如果对构建产物目录结构有特殊需求,则可以使用 buildConfig API,可以通过以下文档来了解使用方式:\n\n * 修改输出产物\n * 深入理解构建\n\n\n发布组件#\n\n推荐使用 Modern.js Module 提供的版本发布功能,可以参考 「版本管理与发布」。","routePath":"/module-tools/guide/best-practices/components","lang":"zh","toc":[{"text":"初始化项目","id":"初始化项目","depth":2,"charIndex":40},{"text":"使用 Storybook 调试代码","id":"使用-storybook-调试代码","depth":2,"charIndex":166},{"text":"开发样式","id":"开发样式","depth":2,"charIndex":227},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":335},{"text":"Less","id":"less","depth":3,"charIndex":587},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":680},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":784},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":832},{"text":"配置构建产物","id":"配置构建产物","depth":2,"charIndex":1071},{"text":"发布组件","id":"发布组件","depth":2,"charIndex":1431}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":73,"title":"使用 Tailwind CSS","content":"#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\nModern.js Module 支持使用 Tailwind CSS 开发组件样式。\n\n\n启用 Tailwind CSS#\n\n在 Modern.js Module 中使用 Tailwind CSS,你只需要按照以下步骤操作:\n\n 1. 在项目根目录下执行 pnpm run new,按照如下进行选择:\n\n\n\n成功开启后,你会看到 package.json 中新增了 tailwindcss 和 @modern-js/plugin-tailwindcss 依赖。\n\n 2. 在 modern.config.ts 中注册 Tailwind 插件:\n\n\n\n 3. 创建 index.css 文件,添加以下代码:\n\n\n\nINFO\n\n根据需求不同,你可以选择性地导入 Tailwind CSS 提供的 CSS 样式。请参考 @tailwind 文档 来了解 @tailwind 指令的详细用法。\n\n 4. 引用 index.css 文件,比如在入口的 src/index.jsx 文件添加如下代码:\n\n\n\n 5. 然后即可在各个组件中使用 Tailwind CSS 提供的 Utility Class 了:\n\n\n\n\n配置 Tailwind CSS#\n\n在 Modern.js Module 中,你有两种方式来配置 Tailwind CSS:\n\n 1. 使用 tailwind.config.{ts,js} 文件,该用法与 Tailwind CSS 的官方用法一致,请参考 \"Tailwind CSS -\n Configuration\" 来了解更多用法。\n\n\n\nTIP\n\n请升级 Modern.js Module 到 >= 2.33.0 版本,以支持自动读取 tailwind.config.{ts,js} 文件。\n\n 2. 使用 style.tailwindcss 配置项,这是旧版本的用法,我们更推荐使用 tailwind.config.{ts,js} 文件进行配置。\n\n\n\n如果你同时使用了 tailwind.config.{ts,js} 文件和 style.tailwindcss 选项,那么 style.tailwindcss\n定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n\n\nTailwind CSS 自动补全#\n\nTailwind CSS 官方提供了 Tailwind CSS IntelliSense 插件,用于在 VS Code 中自动补全 Tailwind CSS 的\nclass names、CSS functions 和 directives。\n\n你可以参考以下步骤来启动自动补全功能:\n\n 1. 在 VS Code 中安装 Tailwind CSS IntelliSense 插件。\n 2. 如果项目的根目录没有 tailwind.config.{ts,js} 文件,那么你需要创建该文件,并写入当前项目的 Tailwind CSS 配置,否则\n IDE 插件将无法正确生效。\n\n\n构建模式#\n\n在使用 Tailwind CSS 时,请注意构建产物在 bundle 和 bundleless 两种模式下会有很大区别。\n\nTIP\n\n关于 bundle 和 bundleless 的定义,可以查看 「深入理解构建」\n\n\nBundle 模式#\n\n在 Bundle 模式下,会生成一份单独的产物 CSS 文件,并且 JS 产物不会自动引用产物 CSS 文件。\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n\n如果你需要将样式注入 JS 产物中,可以开启 style.inject 选项。\n\n如果你没有开启 style.inject,那么也可以让用户手动引用产物 CSS 文件:\n\n\n\n\nBundleless 模式#\n\n在 Bundleless 模式下,默认会引用产物 CSS 文件,无须进行额外处理。\n\n * 产物代码:\n\n\n\n\n类名前缀#\n\n你可以通过 Tailwind CSS 提供的 prefix 选项来添加类名前缀,这样可以避免潜在的类名冲突问题(比如 App 和 Module 使用了不同版本的\nTailwind CSS)。\n\n例如,通过 prefix 选项添加 foo- 前缀:\n\n\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n用法介绍#\n\n下面是一些 Tailwind CSS 的用法示例。\n\n\nHTML 类名#\n\nTailwind CSS 支持在 HTML 标签上通过类名的方式增加样式。当使用 HTML 类名的时候,请注意必须要提前导入 Tailwind CSS 相应的\nCSS 样式。\n\n\n\n样式产物(此时是 bundle 构建):\n\n\n\n\n@apply#\n\nTailwind CSS 提供了 @apply 指令,可以通过它将 Tailwind CSS 提供的样式内联到我们编写的样式中。\n\n@apply 可以用于 CSS、Less、Sass 中。\n\n\n\n但是使用过程中,对于 Less 和 Sass 有些情况需要注意:\n\nSass#\n\n当将 Tailwind 与 Sass 一起使用时,@apply 后面存在 !important 的时候,需要使用插值来让 Sass 正确编译。\n\n * 不能正常工作:\n\n\n\n * 能够正常工作:\n\n\n\nLess#\n\n在与 Less 一起使用 Tailwind 时,你不能嵌套 Tailwind 的 @screen 指令。\n\n * 不能正常工作:\n\n\n\n * 相反,使用常规的媒体查询和 theme() 函数来引用你的屏幕尺寸,或者干脆不要嵌套你的 @screen 指令。\n\n\n\n\n\n\n关于 designSystem 配置#\n\ndesignSystem 是 Modern.js Module 中废弃的配置项。\n\n从 Modern.js Module v2.33.0 版本开始,你可以使用 Tailwind CSS 的 theme 配置项来代替\ndesignSystem,不再需要将 theme 配置拆分并设置到 designSystem 上。\n\n * 旧版本用法:\n\n\n\n * 当前版本用法:\n\n","routePath":"/module-tools/guide/best-practices/use-tailwindcss","lang":"zh","toc":[{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":2,"charIndex":127},{"text":"配置 Tailwind CSS","id":"配置-tailwind-css","depth":2,"charIndex":585},{"text":"Tailwind CSS 自动补全","id":"tailwind-css-自动补全","depth":2,"charIndex":1047},{"text":"构建模式","id":"构建模式","depth":2,"charIndex":1360},{"text":"Bundle 模式","id":"bundle-模式","depth":3,"charIndex":1477},{"text":"Bundleless 模式","id":"bundleless-模式","depth":3,"charIndex":1660},{"text":"类名前缀","id":"类名前缀","depth":2,"charIndex":1732},{"text":"用法介绍","id":"用法介绍","depth":2,"charIndex":1890},{"text":"HTML 类名","id":"html-类名","depth":3,"charIndex":1925},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":2192},{"text":"Less","id":"less","depth":4,"charIndex":2300},{"text":"关于 `designSystem` 配置","id":"关于-designsystem-配置","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":74,"title":"通用类问题","content":"#\n\n\nModern.js Module 和 Rsbuild 的关系?#\n\nModern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于解决 Web 应用构建场景。\n\n\nModern.js Module 是否可以使用 webpack plugin 或者 loader?#\n\nModern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。 这里可以发现更多 esbuild 社区插件\n\n如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 UMD Plugin 构建 UMD 产物。","routePath":"/module-tools/guide/faq/basic","lang":"zh","toc":[{"text":"Modern.js Module 和 Rsbuild 的关系?","id":"modernjs-module-和-rsbuild-的关系","depth":2,"charIndex":3},{"text":"Modern.js Module 是否可以使用 webpack plugin 或者 loader?","id":"modernjs-module-是否可以使用-webpack-plugin-或者-loader","depth":2,"charIndex":103}],"domain":"","frontmatter":{},"version":""},{"id":75,"title":"构建相关问题","content":"#\n\n这里只记录了一些常见问题和 bad case。\n\n如果是构建产物不符合预期的场景,尤其是配置了 buildPreset 的情况下, 请先了解 buildPreset 代表了哪些配置项,再根据所有的配置项逐个检查\n\n\n产物问题#\n\n\nClass Fields 的初始化处理#\n\nTypeSript 提供了 useDefineForClassFields 配置用于控制对于 public class fields 的转换处理。\n\n如果有一段代码:\n\n\n\n当 useDefineForClassFields 为 false 的时候,则编译后的代码会变为:\n\n\n\n当 useDefineForClassFields 为 true 的时候,则编译后的代码会变为:\n\n\n\n同时该配置的默认值会根据 tsconfig.json 的 target 配置而变化:当 target 是 ES2022 或者更高的时候,则\nuseDefineForClassFields 默认配置为 true,否则就是默认为 false。\n\n关于 TypeScript 这个配置的更多信息,可以参考下面的链接:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nModern.js Module 目前会根据下面的逻辑进行处理:\n\n 1. 首先根据当前项目的 tsconfig.json 的 useDefineForClassFields 配置确定在 Modern.js Module\n 内部如何处理。目前只会读取当前项目路径下的 tsconfig.json 文件的内容,暂时不支持根据 extends 配置来获取最终的 tsconfig\n 配置。\n 2. 如果没有检测 tsconfig.json 的 useDefineForClassFields 配置,则会根据 tsconfig.json 的\n target 配置来确定默认值。如果 target 大于 ES2022(包含 EsNext),则useDefineForClassFields默认为\n true,否则为 false。\n 3. 如果没有检测到 tsconfig.json 的 target,则按照 useDefineForClassFields的值 为 true 进行处理。\n\n\nbabel-plugin-lodash 将引入的 lodash 处理成 undefined#\n\n当使用类似下面的方式的时候,会出现这个问题:\n\n\n\n目前在 babel-plugin-lodash Github 上的相关 Issue:\n\n * #235\n\n这个问题的解决办法是移除 babel-plugin-lodash,因为此时不需要该插件进行按需引用,使用该插件会产生副作用。\n\n类似的情况在 babel-plugin-import 上也可能会出现。比如有类似如下的代码:\n\n\n\n此时 babel-plugin-import 也可能会导致 Comps 变为 undefined。因此也需要移除对应的 babel-plugin-import。\n\n\nCannot find module 'http'#\n\n如果产物在浏览器运行时报了类似 Cannot find module 'http' 的错误,说明你的产物打包进了 node 模块。\n这可能会发生于你的依赖里有一些同时支持 browser 和 node 的三方包,例如 axios,此时只需要将 platform 设置为 browser 即可。\n如果一些三方包不支持 browser, 你可能需要手动注入 node polyfill。\n\n\n异常类问题#\n\n\nDynamic require of \"react\" is not supported#\n\n问题描述#\n\n当构建的产物配置中产物格式为 ES modules 的时候:\n\n\n\n如果导入了的第三方 npm 包的 cjs 产物,那么生成的产物可能会在 webpack 下有可能无法正常运行。\n\n\n\n解决办法#\n\n 1. 首先需要找到是哪个第三方包引起的问题。例如报错信息中指向了 react 这个包,那么就要寻找在哪个第三方包里存在 require('react')\n 这样的代码。比如 react-draggable ,这个包仅包含 cjs 产物,那么问题定位到 react-draggable 这个包。\n 2. 然后我们需要将这个包通过下面的配置进行排除,即不打包存在问题的第三方包。\n\n\n\n参考链接#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\n编译过程中,因为某个组件库的 less 文件报错:'Operation on an invalid type'#\n\n可能是因为该组件库依赖的 Less 版本是 v3,而 Modern.js Module 默认是 v4。v3 与 v4 在 math 配置上存在有 Break\nChange,可以查看这个链接 了解详情。\n\n因此,如果是在源码中使用了类似这样的组件库:\n\n在构建配置中使用了 buildPreset 的情况下,按照下面进行修改:\n\n\n\n或者使用了自定义的 buildConfig 的情况下,按照下面进行修改:\n\n\n\n如果是在 Storybook 中使用了类似这样的组件,则需要修改 Storybook 的调试配置:\n\n\n\n\nBundleless DTS failed#\n\n在不打包的场景下,是直接 tsc\n生成类型声明文件。通过终端打印的错误信息,你可以找到问题文件。对于源码文件,推荐将类型问题进行修复,这能够更好地使你的包得到复用。但如果遇到三方包的类型检查问题\n:\n\n 1. 开启 skipLibCheck 来跳过三方包的 d.ts 检查。\n 2. 如果三方包直接导出 ts 文件, skipLibCheck 将会失效,因为其只能跳过 d.ts 检查,因此你只能关闭 dts.abortOnError\n 来忽略这些错误。\n\n\nBundle DTS failed#\n\nModern.js Module 直接使用 rollup-plugin-dts 来打包你的类型描述文件。 它可能无法处理某些第三方依赖的类型文件。\n\n如果遇到 Modern.js Module 构建过程中出现 Bundle DTS failed\n的错误信息标题的时候,可以观察报错信息是来自某个第三方依赖。尝试设置 dts.respectExternal 为 false\n来关闭打包第三方依赖的类型文件的行为。\n\n\ndefineConfig 函数类型报错:如果没有引用 \"...\",则无法命名 \"default\" 的推断类型#\n\n检查项目的 tsconfig.json 文件中是否存在 include 配置,如果没有,则尝试增加下面的内容:\n\n\n\n\n其他#\n\n\nbundleless 如何跳过对 less / scss 文件的预处理#\n\nbundleless 是单文件编译的方式,只需要将你的 less / scss 文件从入口里移除并且将其拷贝到产物里即可。 注意我们还会把 js 引用 less\n/ scss 的 moduleId 进行改写,你可以通过 redirect 配置关闭它。\n\n下面是一个跳过 less 文件处理的例子,你会发现 src 里面所有的 less 文件都被拷贝到 dist 里并且保留了一致的相对路径。\n\n\n\n\n增加额外的编译能力#\n\nModern.js Module 基于 esbuild 实现,因此如果有特殊需求或者想要增加额外的编译能力,可以通过实现 esbuild 插件来解决。\n\nModern.js Module 提供了 esbuildOptions 配置允许修改 Modern.js Module 内部的 esbuild\n配置,因此可以通过该配置来增加自定义的 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\n\n支持生成 CSS Modules 的 TypeScript 声明文件#\n\n * 方案一:typed-css-modules\n * 方案二:postcss-modules-dts\n\n","routePath":"/module-tools/guide/faq/build","lang":"zh","toc":[{"text":"产物问题","id":"产物问题","depth":2,"charIndex":110},{"text":"Class Fields 的初始化处理","id":"class-fields-的初始化处理","depth":3,"charIndex":118},{"text":"babel-plugin-lodash 将引入的 lodash 处理成 `undefined`","id":"babel-plugin-lodash-将引入的-lodash-处理成-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":1337},{"text":"异常类问题","id":"异常类问题","depth":2,"charIndex":1559},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":1568},{"text":"问题描述","id":"问题描述","depth":4,"charIndex":1614},{"text":"解决办法","id":"解决办法","depth":4,"charIndex":1714},{"text":"参考链接","id":"参考链接","depth":4,"charIndex":1916},{"text":"编译过程中,因为某个组件库的 less 文件报错:`'Operation on an invalid type'`","id":"编译过程中因为某个组件库的-less-文件报错operation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":2338},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":2595},{"text":"`defineConfig` 函数类型报错:`如果没有引用 \"...\",则无法命名 \"default\" 的推断类型`","id":"defineconfig-函数类型报错如果没有引用-则无法命名-default-的推断类型","depth":3,"charIndex":-1},{"text":"其他","id":"其他","depth":2,"charIndex":2940},{"text":"bundleless 如何跳过对 less / scss 文件的预处理","id":"bundleless-如何跳过对-less--scss-文件的预处理","depth":3,"charIndex":2946},{"text":"增加额外的编译能力","id":"增加额外的编译能力","depth":3,"charIndex":3184},{"text":"支持生成 CSS Modules 的 TypeScript 声明文件","id":"支持生成-css-modules-的-typescript-声明文件","depth":3,"charIndex":3492}],"domain":"","frontmatter":{},"version":""},{"id":76,"title":"常见问题","content":"#\n\n这里是 Modern.js Module 常见问题分类列表:\n\n * 通用类问题\n * 构建相关问题\n * Storybook 相关问题","routePath":"/module-tools/guide/faq/","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":77,"title":"Storybook 相关问题","content":"#\n\n\n支持 Storybook v7#\n\nStorybook v7 目前已全面支持并已成为我们的推荐使用版本。\n\n\n使用 Storybook Addon 或者其他配置不生效#\n\nModern.js Module 目前使用的 Storybook 版本是 v6,如果使用了 v7 版本的 Addon 可能会出现插件不生效的情况。\n\n除了 Addon 以外,其他配置也可能会有区别。比如修改 preview.js 配置文件的话,Storybook v6 与 v7 的写法也不相同:\n\n * v6:文档链接\n * v7:文档链接\n\n\nCannot find module 'react-dom/package.json'#\n\n在执行 Storybook 调试的时候,出现下面的报错提示:\n\n\n\n解决办法:在项目中安装 react-dom 依赖。\n\n\n\n\n报错后,看不到具体报错信息#\n\n解决办法:\n\n 1. 找到 @storybook/core-server/dist/cjs/dev-server.js\n 2. 找到 var _await$Promise$all = await Promise.all([preview, manager 这附近的代码。\n 3. 修改成:\n\n\n\n\nCouldn't find any stories is your Storybook#\n\n\n\n当在预览区域看到类似这样的报错提示的时候,首先可以打开一下浏览器的控制台,应该会有些报错信息。可以先根据报错信息来推断是不是编写代码里出现的问题导致\nStorybook 无法正常运行。修复后,再次刷新查看是否正常。\n\n\nStorybook 添加 Proxy 功能#\n\nStorybook 没有提供相关方案,不过 Storybook Issue 中有找到相关的解决办法。在 Modern.js Module 中,你可以:\n\n 1. 添加 .storybook/middleware.js 文件,并初始化下面的内容:\n\n\n\n 2. 添加 http-proxy-middleware 依赖\n 3. 添加代理路由相关配置\n\n\n\n相关 issue 链接:#11551。\n\n\nTailwind CSS 在 Storybook 中不生效#\n\nModern.js Module 的 Storybook 构建能力由 Rsbuild 提供,由于 Rsbuild 的底层实现与 Modern.js Module\n并未打通,因此, Modern.js Module 插件无法在 Storybook (Rsbuild) 中生效。\n\n解决办法:需要在 storybook 中单独注册 tailwindcss 的 PostCSS 插件。\n\n参考链接:Rsbuild - tailwindcss。","routePath":"/module-tools/guide/faq/storybook","lang":"zh","toc":[{"text":"支持 Storybook v7","id":"支持-storybook-v7","depth":2,"charIndex":3},{"text":"使用 Storybook Addon 或者其他配置不生效","id":"使用-storybook-addon-或者其他配置不生效","depth":2,"charIndex":58},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":263},{"text":"报错后,看不到具体报错信息","id":"报错后看不到具体报错信息","depth":2,"charIndex":373},{"text":"Couldn't find any stories is your Storybook","id":"couldnt-find-any-stories-is-your-storybook","depth":2,"charIndex":538},{"text":"Storybook 添加 Proxy 功能","id":"storybook-添加-proxy-功能","depth":2,"charIndex":696},{"text":"Tailwind CSS 在 Storybook 中不生效","id":"tailwind-css-在-storybook-中不生效","depth":2,"charIndex":918}],"domain":"","frontmatter":{},"version":""},{"id":78,"title":"快速开始","content":"#\n\n\n三分钟快速上手#\n\n想要实际体验 Modern.js Module?首先你需要安装 Node.js LTS,并确保 Node 版本大于等于 16.0.0。我们推荐使用\nNode.js 18 的 LTS 版本。\n\n\n创建新项目#\n\n如果你想要创建一个完整的 Modern.js Module 项目,可以执行以下命令:\n\n\n\nINFO\n\n执行 npx @modern-js/create -h 查看更多命令行参数\n\n接着在问题交互中,按照如下选择:\n\n\n\n> 项目名称为 package.json 中的 \"name\" 字段值。\n\n接着就会开始初始化项目的流程。在项目目录和文件生成以及依赖安装完毕后,此时就创建了一个完整的 Modern.js Module 项目。\n\n我们可以直接执行 pnpm build 命令启动项目的构建,执行 pnpm build --watch 命令开启构建的观察模式。\n\n\n接入已有项目#\n\n在你的项目里安装以下依赖:\n\n * \"@modern-js/module-tools\"\n\n * \"typescript\"(如果不是 TypeScript 项目,则省略)\n\n> 对于使用 pnpm 或者 Yarn 包管理器的项目,只需要替换 npm 就可以了。推荐使用 pnpm。\n\n接着在项目的根目录下创建 modern.config.(t|j)s 文件:\n\n\n\n最后在项目的 package.json 文件里增加命令 \"build\": \"modern build\":\n\n\n\n如果你的项目存在 src/index.(js|jsx) 文件或者同时存在 src/index.(ts|tsx) 和 tsconfig.json\n文件,那么恭喜你可以运行直接运行 npm run build 来使用 Modern.js Module 构建你的项目了。\n\n\n核心 npm 包#\n\n@modern-js/module-tools 是 Modern.js Module 的核心 npm 包,主要提供以下能力:\n\n * 提供 modern dev, modern build 等常用的 CLI 命令。\n * 集成 Modern.js Core,提供配置解析、插件加载等能力。\n * 集成 esbuild 和 SWC,提供构建能力。\n * 集成一些最为常用的插件,比如 plugin-lint、plugin-changeset 等。\n\n@modern-js/module-tools 是基于 Modern.js 的插件体系实现的,本质上是一个插件,因此你需要在配置文件的 plugins\n字段中注册 moduleTools:\n\n\n\n\n查看官方示例#\n\n如果你想要看看使用了 Modern.js Module 的完整项目,可以执行以下命令:\n\n\n\n\n让我们开始吧#\n\n选择适合你的教程:\n\n * 我是初学者,需要学习 Modern.js Module 的基础使用。\n * 我已经初步掌握了 Modern.js Module 的使用,可以学习 Modern.js Module 的进阶指南。\n * 我需要扩展项目能力,需要学习如何开发 Modern.js Module 的插件。","routePath":"/module-tools/guide/intro/getting-started","lang":"zh","toc":[{"text":"三分钟快速上手","id":"三分钟快速上手","depth":2,"charIndex":3},{"text":"创建新项目","id":"创建新项目","depth":3,"charIndex":110},{"text":"接入已有项目","id":"接入已有项目","depth":3,"charIndex":402},{"text":"核心 npm 包","id":"核心-npm-包","depth":3,"charIndex":784},{"text":"查看官方示例","id":"查看官方示例","depth":3,"charIndex":1118},{"text":"让我们开始吧","id":"让我们开始吧","depth":2,"charIndex":1175}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":79,"title":"欢迎使用","content":"#\n\nModern.js Module 是 Modern.js\n的模块工程解决方案,同时也是核心依赖。它可以让开发者更轻松地构建、调试、发布模块类型的项目。模块类型的项目大多数情况可以认为是 npm\n包类型的项目,它可能是一个组件、组件库或者工具库项目。\n\n如果你正打算开发一个 npm 包类型的项目,那么你就来对地方了!Modern.js 提供了专业的模块工程解决方案。它带来了:\n\n * 简单的项目初始化:仅需执行 npx @modern-js/create project-dir\n 命令,然后进行几个交互问题,就可以创建一个完整的模块类型项目。创建的项目还支持选择 pnpm、Yarn 两种包管理器。\n * 代码格式化:在模块工程项目中,你可以执行 modern lint 来对代码进行格式化。同时初始化的模块工程项目里包含了 Modern.js 的\n ESLint 规则集,可以满足大部分场景下的需求。\n * 全面的构建能力和更快的构建速度:Modern.js Module 基于 esbuild 和 SWC\n 提供了高性能的构建能力,并且为不同构建模块的场景提供了丰富的配置。\n * Storybook 调试工具:Modern.js Module 为调试模块项目提供了 Storybook 调试工具。在安装了 Modern.js\n Module 的 Storybook 插件后,你可以使用 storybook dev 命令来启动它。你不仅可以使用 Storybook\n 对组件进行调试,也可以使用在其他类型的模块上。\n * 基于 Changesets 实现的版本管理:当需要对项目记录变更内容的时候,可以使用 modern change 命令生成包含变更内容的 Markdown\n 文件;当需要对项目进行版本升级的时候,可以使用 modern bump 命令通过 Markdown 文件分析并升级版本;当需要发布项目的时候,可以使用\n modern release 命令对项目进行发布。Modern.js Module 基于 Changesets 实现了这些命令。\n * 可扩展性的插件机制:想要为项目集成其他的调试工具?又或者是想要在构建过程中做一些额外处理?Modern.js Module\n 提供了插件机制和插件钩子,插件钩子覆盖了 dev 命令和 build 命令两个流程。你可以通过它们为项目进行能力的扩展。\n * 还有更多:Modern.js Module\n 在未来还会不断地在构建、调试功能上进行优化。如果在模块项目构建上存在需要解决的重要问题,又或者是某个主流的模块项目调试工具、模式出现的时候,那么它们很可能\n 成为 Modern.js Module 将要支持功能。","routePath":"/module-tools/guide/intro/welcome","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":80,"title":"为什么需要 Modern.js Module","content":"#\n\n大家可能都经历过:从零开始开发一个组件库或者工具库的过程中,我们不仅要考虑项目本身的代码逻辑如何编写,还要考虑项目的构建、调试、测试、代码格式化等等和代码逻辑无\n关的事情。\n\n比如说,当我们考虑构建模块项目的代码是使用什么构建工具的时候,在之前我们可能会考虑使用 webpack 还是 Rollup,然而现在的话,也许还会考虑是使用\nesbuild 还是 SWC。\n\n无论选择哪个构建工具,这对于没有熟练掌握这些构建工具使用方式的开发者来说,是需要一定的成本去学习的。即使想要快速使用,也会需要花费大量的时间和精力。\n\n而除了构建这件事情以外,像为项目提供调试工具、支持测试能力、增加代码格式校验等等,对于一个新手来说都有可能需要花费很长的时间和精力了解或者掌握它们,并且真正的服\n务于当前的项目中。\n\n而为了保证代码质量以及项目的完整性,我们往往是需要做这些与代码逻辑实现无关的事情。然而这些事情很有可能会影响整体的项目开发进度,降低开发者的开发体验,会让开发者\n感觉模块项目的开发门槛很高。\n\n如果说每次开发一个模块类型的项目都需要经历一遍这些工作准备的话,那么基本上刚开始开发的时间会大部分花费在这些与代码实现无关的事情上。如果能够提供一个模块工程解决\n方案,它能够帮助开发者解决项目工程上的事情,让开发者可以更专注于代码的实现上,那么这将会大大提升模块类型项目的开发体验。\n\n\n\nModern.js 为了让开发模块类型的项目更简单、解决上述提到的问题,提供了模块工程解决方案,并且通过 Modern.js Module\n提供了主要的功能。Modern.js Module 可以理解为是一个专门用于模块类型项目开发的工具。","routePath":"/module-tools/guide/intro/why-module-engineering-solution","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":82,"title":"快速开始","content":"#\n\nModern.js Module 不仅提供了丰富的功能,同时也支持通过插件的方式为当前项目扩展能力。\n\n我们可以通过下面的例子来快速了解如何编写一个 Modern.js Module 插件:\n\n 1. 首先我们在初始化的项目下创建 ./plugins/example.ts 文件。\n\n\n\n 2. 接着在 example.ts 文件中增加插件的代码。\n\n\n\n 3. 然后我们通过 plugins API,将刚刚写好的插件进行注册。\n\n\n\n 4. 最后运行 modern build,就可以看到:\n\n\n\n通过上面这个例子,我们了解到了下面几件事:\n\n * 推荐的插件目录结构\n * 插件的初始化代码\n * 插件的注册\n\n除了以上内容以外,我们还需要了解:\n\n * 插件对象、类型定义与推荐配置项\n * setup 函数、api 对象参数、生命周期钩子","routePath":"/module-tools/plugins/guide/getting-started","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":83,"title":"插件对象","content":"#\n\nModern.js Module 的插件是一个对象,对象包含以下属性:\n\n * name:插件的名称,唯一标识符。\n * setup:插件初始化函数,只会执行一次。setup 函数可以返回一个 Hooks 对象,Modern.js Module 会在特定的时机执行 Hooks\n 对象上定义的 Hook 对应的函数。\n\n例如在下面的插件代码示例中,在项目开始执行构建任务之前会触发 beforeBuild 函数的执行,并打印 build start 的 log 内容。\n\n\n\n\n\n\n插件类型定义#\n\n使用 TypeScript 时,可以引入内置的 CliPlugin 和 ModuleTools 类型,为插件提供正确的类型推导:\n\n\n\n\n插件配置项#\n\n建议将插件写成函数的形式,使插件能通过函数入参来接收配置项:\n\n","routePath":"/module-tools/plugins/guide/plugin-object","lang":"zh","toc":[{"text":"插件类型定义","id":"插件类型定义","depth":2,"charIndex":245},{"text":"插件配置项","id":"插件配置项","depth":2,"charIndex":323}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":84,"title":"Setup 函数","content":"#\n\n在「插件对象」 部分我们知道插件对象包含了一个 setup 函数,该函数不仅包含了一个 api 对象参数,同时还可以返回一个 Hooks 对象。\n\n\n插件 API 对象#\n\n插件的 setup 函数会提供一个 api 对象参数,你可以调用该对象上提供的一些方法来获取到配置、项目上下文等信息。\n\n\n\n\napi.useAppContext#\n\n用于获取项目上下文信息。\n\n\n\nINFO\n\n通过实际的类型文件,我们可以看到还存在一些其他字段,不过目前对于 Modern.js Module 有意义的字段只有以上内容,api 对象其他的方法也是如此。\n\n\napi.useResolvedConfigContext#\n\n用于获取解析之后的最终配置。\n\nINFO\n\n如果需要获取构建相关的最终配置,需要使用 beforeBuild Hook。\n\n\n\n\napi.useHookRunners#\n\n用于获取 Hooks 的执行器,并触发特定的 Hook 执行。\n\n\n\n\n异步 setup#\n\nCLI 插件的 setup 可以是一个异步函数,在初始化过程中执行异步逻辑。\n\n\n\n注意,只有当前插件的 setup 异步函数执行完毕,才会继续执行下一个插件的 setup 函数。因此,你需要避免在 setup\n函数中进行耗时过长的异步操作,防止影响 CLI 启动性能。\n\n\n生命周期钩子#\n\n我们知道 setup 函数会返回一个 Hooks 对象,所谓 Hooks 对象也可以理解是具有 Modern.js Module 生命周期钩子的对象。\n\n目前主要包含两类钩子:\n\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n关于生命周期钩子的完整列表参考 API 文档。","routePath":"/module-tools/plugins/guide/setup-function","lang":"zh","toc":[{"text":"插件 API 对象","id":"插件-api-对象","depth":2,"charIndex":77},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"异步 setup","id":"异步-setup","depth":2,"charIndex":430},{"text":"生命周期钩子","id":"生命周期钩子","depth":2,"charIndex":579}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":85,"title":"总览","content":"#\n\n\n官方插件#\n\n * @modern-js/plugin-module-import:使用 SWC 提供与 babel-plugin-import 一样的能力。\n * @modern-js/plugin-module-banner:为每个 JS 和 CSS 文件的顶部和底部添加自定义内容,例如版权信息。\n * @modern-js/plugin-module-node-polyfill:会自动注入 Node 核心模块在浏览器端的 polyfills。\n * @modern-js/plugin-module-polyfill:为你的代码中使用到的不支持的功能注入 polyfill。\n * @modern-js/plugin-module-babel:使用 Babel 转换你的代码。\n * @modern-js/plugin-module-vue:提供对 Vue 3 组件构建的支持。","routePath":"/module-tools/plugins/official-list/overview","lang":"zh","toc":[{"text":"官方插件","id":"官方插件","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":86,"title":"Babel 插件","content":"#\n\nTIP\n\n通常情况下,我们无需使用 Babel 转换我们的代码,此插件仅作为一种降级方式。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时需要打包 A,B 两个文件,并只需要在打包 A 时使用 babel:\n\n\n\n\n配置#\n\nSee Babel options\n\n下面是一个配置了@babel/preset-env的例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-babel","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":50},{"text":"安装","id":"安装","depth":3,"charIndex":58},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":64},{"text":"配置","id":"配置","depth":2,"charIndex":172}],"domain":"","frontmatter":{},"version":""},{"id":87,"title":"Banner 插件","content":"#\n\n提供为每个 JS 和 CSS 文件的顶部和底部注入内容的能力。\n\nTIP\n\n从 @modern-js/module-tools 2.36.0 版本开始,该插件功能内置在 Modern.js Module 中,由 banner 和\nfooter 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\nTIP\n\n注意:CSS 的注释不支持 //comment 这样的写法。详见「CSS 注释」\n\n\n示例#\n\n\n在 JS 文件顶部增加版权信息#\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nbanner#\n\n在顶部增加内容。\n\n * banner.js:在 JS 文件顶部增加内容。\n * banner.css:在 CSS 文件顶部增加内容。\n\n\nfooter#\n\n在底部增加内容。\n\n * footer.js:在 JS 文件底部增加内容。\n * footer.css:在 CSS 文件底部增加内容。","routePath":"/module-tools/plugins/official-list/plugin-banner","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":132},{"text":"安装","id":"安装","depth":3,"charIndex":140},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":146},{"text":"示例","id":"示例","depth":2,"charIndex":240},{"text":"在 JS 文件顶部增加版权信息","id":"在-js-文件顶部增加版权信息","depth":3,"charIndex":246},{"text":"配置","id":"配置","depth":2,"charIndex":267},{"text":"banner","id":"banner","depth":3,"charIndex":283},{"text":"footer","id":"footer","depth":3,"charIndex":362}],"domain":"","frontmatter":{},"version":""},{"id":88,"title":"Import 插件","content":"#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现。\n\nTIP\n\n从 @modern-js/module-tools 2.16.0 版本开始,该插件功能内置在 Modern.js Module 中,由\ntransformImport 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n这样我们就可以在 Modern.js Module 中使用自动导入的能力了。\n\n\n配置#\n\n * 类型:\n\n\n\n\npluginImport#\n\n * 类型:object[]\n\n其中数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n\n注意事项#\n\nSWC (Speedy Web Compiler) 是基于 Rust 语言编写的,而该插件是基于 SWC,移植自\nbabel-plugin-import,配置选项保持了一致。\n\n一些配置可以传入函数,例如 customName,customStyleName 等, 但在 Modern.js Module\n里,我们不建议在此配置项里使用函数。 因为我们会在 esbuild 的插件里调用 SWC,然后再当 Rust 通过 Node-API\n调用这些配置函数时,会出现死锁现象。\n\n简单的函数逻辑其实可以通过模版语言来代替,下面是一个 customName 使用模板的示例:\n\n\n\n添加以下配置:\n\n\n\n其中的 {{ member }} 会被替换为相应的引入成员,转换后:\n\n\n\n可以看出配置 customName: \"foo/es/{{ member }}\" 的效果等同于配置 customName: (member) =>\n`foo/es/${member}` 。\n\n这里使用到的模版是 handlebars,模版配置中还内置了一些有用的辅助工具,还是以上面的导入语句为例,配置成:\n\n\n\n会转换成下面的结果:\n\n\n\n除了 kebabCase 以外还有 camelCase,snakeCase,upperCase,lowerCase 可以使用。","routePath":"/module-tools/plugins/official-list/plugin-import","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":144},{"text":"安装","id":"安装","depth":3,"charIndex":152},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":158},{"text":"配置","id":"配置","depth":2,"charIndex":245},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":261},{"text":"注意事项","id":"注意事项","depth":2,"charIndex":357}],"domain":"","frontmatter":{},"version":""},{"id":89,"title":"Node Polyfill 插件","content":"#\n\nNode Polyfill 介绍\n\n通常情况下,我们不会在浏览器端使用 Node 模块。但在当前代码需要同时在 Node 端和浏览器端运行时,用到一些 Node 模块是有可能的。Node\nPolyfill 为这些 Node 模块提供了浏览器版本的 polyfills。\n\n通过使用 Node Polyfill 插件,会自动注入 Node 核心模块在浏览器端的 polyfills,让你可以在浏览器端放心使用这些模块。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nexclude#\n\n排除要注入的 Node Polyfill。\n\n\n\n\noverrides#\n\n覆盖内置的 Node Polyfill。\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\n当你在代码中使用以上全局变量时,对应 polyfill 会被自动注入。\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\n当你通过 require 或 import 等语法在代码中引用以上模块时,对应 polyfill 会被注入。\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\n目前浏览器端没有以上模块的 polyfill,因此当你引用以上模块时,会自动 fallback 为一个空对象。\n\n","routePath":"/module-tools/plugins/official-list/plugin-node-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":213},{"text":"安装","id":"安装","depth":3,"charIndex":221},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":227},{"text":"配置","id":"配置","depth":2,"charIndex":274},{"text":"exclude","id":"exclude","depth":3,"charIndex":290},{"text":"overrides","id":"overrides","depth":3,"charIndex":326},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":363},{"text":"Globals","id":"globals","depth":3,"charIndex":381},{"text":"Modules","id":"modules","depth":3,"charIndex":464},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":860}],"domain":"","frontmatter":{},"version":""},{"id":90,"title":"Polyfill 插件","content":"#\n\nTIP\n\n通常情况下,我们不需要为 npm 包注入 polyfill,这一步应该在 Web\n应用的框架侧完成,但是在某些场景,为了让我们的库能够直接运行在低版本浏览器里,我们需要注入 polyfill。\n\n请注意,此插件并不会转化你的代码语法,只会为你的代码中使用到的不支持的功能注入 polyfill,把它们作为普通函数导入而不是污染全局。你需要安装\ncore-js-pure 依赖\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时具有多份构建配置,并只需要在 bundle 构建时注入 polyfill:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\ntargets#\n\n参考 Babel target.\n\n下面是一个例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":197},{"text":"安装","id":"安装","depth":3,"charIndex":205},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":211},{"text":"配置","id":"配置","depth":2,"charIndex":322},{"text":"targets","id":"targets","depth":3,"charIndex":338}],"domain":"","frontmatter":{},"version":""},{"id":91,"title":"Vue 插件","content":"#\n\nVue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 esbuild-plugin-vue3 和 @vue/babel-plugin-jsx。\n\nWARNING\n\n请注意,此插件仍有一些用法限制:\n\n 1. 目前此插件的实现是直接集成社区插件,因此不支持在 sfc 里写 jsx/tsx。\n 2. 如果要为组件生成 d.ts,请使用官方推荐方式 vue-tsc。\n 3. 仅支持打包场景,推荐将 input 设置为 ['src/**/*.vue'] 或者 ['src/index.ts']。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\n传递给 @vue/babel-plugin-jsx 的选项,请查阅 @vue/babel-plugin-jsx 文档 来了解具体用法。","routePath":"/module-tools/plugins/official-list/plugin-vue","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":256},{"text":"安装","id":"安装","depth":3,"charIndex":264},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":270},{"text":"配置","id":"配置","depth":2,"charIndex":317},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":323}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file diff --git a/modern-js/module-tools/static/search_index.zh.978b7149.json b/modern-js/module-tools/static/search_index.zh.978b7149.json new file mode 100644 index 0000000000..51ae76e146 --- /dev/null +++ b/modern-js/module-tools/static/search_index.zh.978b7149.json @@ -0,0 +1 @@ +[{"id":46,"title":"buildConfig","content":"#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项,它包含了构建的所有配置。\n\n * 类型:object | object[]\n\nTIP\n\n在开始使用 buildConfig 之前,请先阅读以下文档来了解其作用:\n\n * 修改输出产物\n * 深入理解构建\n\n\nalias#\n\n * 类型:Record | Function\n * 默认值:{'@': 'src',}\n\nTIP\n\n对于 TypeScript 项目,只需要在 tsconfig.json 中配置 compilerOptions.paths, Modern.js Module\n会自动识别 tsconfig.json 里的别名,因此不需要额外配置 alias 字段。\n\n\n\n以上配置完成后,如果在代码中引用 @common/Foo.tsx, 则会映射到 /src/common/Foo.tsx 路径上。\n\nalias 的值定义为函数时,可以接受预设的 alias 对象,并对其进行修改。\n\n\n\n也可以在函数中返回一个新对象作为最终结果,新对象会覆盖预设的 alias 对象。\n\n\n\n\nasset#\n\n包含静态资源相关的配置。\n\n\nasset.name#\n\n静态资源输出文件名。\n\n * 类型: string | ((assetPath) => name)\n * 默认值: [name].[hash].[ext]\n\n当 asset.name 为 string 类型时,会自动对 [name]、[ext]、[hash] 进行替换,分别替换为文件名、拓展名、文件 hash。\n如果想要更高的自由度,可以把 asset.name 作为方法使用,返回值即为文件名。此时,该方法接收一个参数 assetPath,对应资源路径。\n\n\n\n\nasset.limit#\n\n用于设置静态资源被自动内联为 base64 的体积阈值。\n\nModern.js Module 在进行打包时,默认会内联体积小于 10KB 的图片、字体、媒体等资源,将它们通过 Base64\n编码,并内联到产物中,不再会发送独立的 HTTP 请求。\n\n你可以通过修改 limit 参数来调整这个阈值。\n\n * 类型: number\n * 默认值: 10 * 1024\n\n例如,将 limit 设置为 0 来避免资源内联:\n\n\n\n\nasset.path#\n\n静态资源输出路径,会基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: assets\n\n\nasset.publicPath#\n\n打包时给未内联资源的 CDN 前缀。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n此时,所有静态资源都会添加 https://xxx/ 前缀。\n\n\nasset.svgr#\n\n打包时将 SVG 作为一个 React 组件处理,options 参考 svgr,另外还支持了 include 和 exclude\n两个配置项,用于匹配需要处理的 SVG 文件。\n\n * 类型: boolean | object\n * 默认值: false\n\n开启 svgr 功能后,可以使用默认导出的方式将 SVG 当做组件使用。\n\n\n\n当开启功能后,可以新建一个类型描述文件,并在 modern-app-env.d.ts 文件中增加,修改使用 SVG 的类型:\n\n\n\n\n\n\nasset.svgr.include#\n\n设定匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: /\\.svg$/\n\n\nasset.svgr.exclude#\n\n设定不匹配的 SVG 文件\n\n * 类型: string | RegExp | (string | RegExp)[]\n * 默认值: undefined\n\n\nasset.svgr.exportType#\n\n用于配置使用 SVGR 时 SVG 的导出形式。\n\n * 类型: 'named' | 'default'\n * 默认值: default\n\n当此选项设置为 'named' 时,你可以使用以下语法导入组件:\n\n\n\n命名导出默认为 ReactComponent,并可以通过 asset.svgr.namedExport 进行自定义。\n\n\nautoExtension#\n\n根据 format 和 type 自动添加产物里 js 文件和类型描述文件的后缀。\n\n * 类型:boolean\n * 默认值:false\n * 版本:>=2.38.0\n\n关闭时,js 产物后缀为 .js,类型描述文件后缀为 d.ts。\n\n开启后,当 type 为 module 时,node 默认将 .js 作为 esm 加载,因此当我们要输出 cjs 产物时,js 产物后缀为\n.cjs,类型描述文件后缀为 d.cts; 反之,如果缺少 type 字段或者 type 为 commonjs 时, node 默认将 .js 文件作为 cjs\n加载,因此当我们要输出 esm 产物时,js 产物后缀为 .mjs,类型描述文件后缀为 d.mts。\n\nWARNING\n\n在 bundleless 模式下使用时,我们会有一步额外的操作,那就是处理每个文件里的 import/export 语句。我们会给相对路径加上 js\n文件后缀,可能是 .mjs 或者 .cjs,这取决于你的包配置,此行为可以通过 redirect.autoExtension关闭。\n\n注意 noUselessIndex 规则会破坏此行为,你需要禁用此规则 如果你需要在 bundleless 使用此配置,请补齐 index,例如 utils\n是一个文件夹, 你需要将 改写为\n\n\n\n\nautoExternal#\n\n自动外置项目的 \"dependencies\" 和 \"peerDependencies\",不会将其打包到最终的 bundle 产物中。\n\n * 类型: boolean | object\n * 默认值: true\n\n当我们希望关闭对于第三方依赖的默认处理行为时候,可以通过以下方式来实现:\n\n\n\n这样对于 \"dependencies\" 和 \"peerDependencies\" 下面的依赖都会进行打包处理。如果只想要关闭其中某个下面的依赖处理,则可以使用\nbuildConfig.autoExternal 的对象形式:\n\n\n\n\nautoExternal.dependencies#\n\n是否需要外置项目的 \"dependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nautoExternal.peerDependencies#\n\n是否需要外置项目的 \"peerDependencies\" 依赖。\n\n * 类型: boolean\n * 默认值: true\n\n\nbanner#\n\n提供为每个 JS , CSS 和 DTS 文件的顶部和底部注入内容的能力。\n\n\n\n * 类型: BannerAndFooter\n * 默认值: {}\n * 版本: >=2.36.0\n\n例如你想为 JS 和 CSS 文件添加版权信息:\n\n\n\n\nbuildType#\n\n构建类型,bundle 会打包你的代码,bundleless 只做代码的转换。\n\n * 类型: 'bundle' | 'bundleless'\n * 默认值: 'bundle'\n\n\ncopy#\n\n将文件或目录拷贝到指定位置。\n\n * 类型: object\n\n\n\n\ncopy.patterns#\n\n * 类型: CopyPattern[]\n * 默认值: []\n\n\n\n\ncopy.options#\n\n * 类型:\n\n\n\n * 默认值: { concurrency: 100, enableCopySync: false }\n\n * concurrency: 指定并行执行多少个复制任务。\n\n * enableCopySync: 使用 fs.copySync,默认情况下 fs.copy。\n\n\ndefine#\n\n定义全局变量,注入到代码中\n\n * 类型: Record\n * 默认值: {}\n\n由于 define 功能是由全局文本替换实现的,所以需要保证全局变量值为字符串,更为安全的做法是将每个全局变量的值转化为字符串,如下所示:\n\nINFO\n\n框架内部会自动进行 JSON 序列化处理,因此不需要手动执行序列化。\n\n如果不需要自动序列化,可以通过配置 esbuildOptions 定义 alias 来实现。\n\n\n\n不过要注意:如果项目是一个 TypeScript 项目,那么你可能需要在项目源代码目录下的 .d.ts 文件里增加以下内容:\n\n> 如果不存在 d.ts 文件,则可以手动创建。\n\n\n\n我们也可以进行环境变量替换:\n\n\n\n通过上面的配置,我们就可以将下面这段代码:\n\n\n\n在执行 VERSION=1.0.0 modern build 的时候,转换为:\n\n\n\nTIP\n\n为了防止全局替换替换过度,建议使用时遵循以下两个原则:\n\n * 全局常量使用大写\n * 自定义全局常量前缀后缀,确保独一无二\n\n\ndts#\n\n类型文件生成的相关配置,默认情况会生成。\n\n * 类型: false | object\n * 默认值:\n\n\n\n\ndts.abortOnError#\n\n用于控制在出现类型错误的时候,是否允许构建成功。\n\n * 类型:boolean\n * 默认值:true\n\n默认情况下,在出现类型错误的时候会导致构建失败。将 abortOnError 设置为 false 后,即使代码中出现了类型问题,构建依然会成功:\n\n\n\nWARNING\n\n当关闭该配置后,无法保证类型文件能正常生成,且不保证内容正确。在 buildType: 'bundle' 时,即打包模式下,类型文件一定不会生成。\n\n\ndts.distPath#\n\n类型文件的输出路径,基于 outDir 进行输出。\n\n * 类型: string\n * 默认值: ./\n\n比如输出到 outDir 下面的 types 目录:\n\n\n\n\ndts.enableTscBuild#\n\n开启 tsc '--build' 选项。当使用 project reference 时, 可以使用 '--build'\n选项以实现项目之间的协同工作以加快构建速度。\n\n此选项要求版本 > 2.43.0, 事实上,我们在 2.42.0 版本曾试验性地开启此选项,但其带来的许多问题使我们不得不动态开启。\n\n\n\n * 类型: boolean\n * 默认值: false\n * 版本: >2.43.0\n\n\n\n\ndts.only#\n\n是否在构建时只生成类型文件,不生成 JavaScript 产物文件。\n\n * 类型: boolean\n * 默认值: false\n\n\n\n\ndts.respectExternal#\n\n当设为 false 时,不会打包任何三方包类型,设为 true 时,会根据 externals 来决定是否需要打包三方类型。\n\n在对类型文件进行打包时,构建工具还未对 export\n进行分析,因此当你引用的任何一个三方包出现类型错误时,都可能会中断当前的构建流程,这会导致构建流程不可控,因此我们可以通过这个配置来避免该问题。\n\n * 类型: boolean\n * 默认值: true\n\n\n\n\ndts.tsconfigPath#\n\n废弃,使用 tsconfig 配置替代。\n\n指定用于生成类型文件的 tsconfig 文件路径。\n\n\n\n\nesbuildOptions#\n\n用于修改底层的 esbuild 配置。\n\n * 类型: Function\n * 默认值: c => c\n\n例如,我们需要修改生成文件的后缀:\n\n\n\n例如,注册一个 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\nTIP\n\n我们在原本 esbuild 构建的基础上做了许多扩展,因此使用此配置需要注意以下几点:\n\n 1. 优先使用 Modern.js Module 提供的配置,例如 esbuild 并不支持 target: 'es5',但我们内部使用 SWC\n 支持了此场景,此时通过 esbuildOptions 设置target: 'es5'会报错。\n 2. 目前我们内部使用 enhanced-resolve 替代了 esbuild 的 resolve 解析算法,所以修改 esbuild resolve\n 相关配置无效,计划在未来会切换回来。\n\n\nexternalHelpers#\n\n默认情况下,输出的 JS 代码可能会依赖一些辅助函数来支持目标环境或者输出格式,这些辅助函数会被内联在需要它的文件中。\n\n使用此配置,将会使用 SWC 对代码进行转换,将内联的辅助函数转换为从外部模块 @swc/helpers 导入这些辅助函数。\n\n * 类型:boolean\n * 默认值:false\n\n下面是使用该配置前后的产物变化比较。\n\n开启前:\n\n\n\n开启后:\n\n\n\n\nexternals#\n\n用于在打包时排除一些外部依赖,避免将这些依赖打包到最终的 bundle 中。\n\n * 类型:\n\n\n\n * 默认值: []\n * 构建类型:仅支持 buildType: 'bundle'\n * 示例:\n\n\n\n\nfooter#\n\n同 banner 配置,用于在输出文件末尾添加注释。\n\n\nformat#\n\n用于设置 JavaScript 产物输出的格式,其中 iife 和 umd 只在 buildType 为 bundle 时生效。\n\n * 类型:'esm' | 'cjs' | 'iife' | 'umd'\n * 默认值:cjs\n\n\nformat: esm#\n\nesm 代表 \"ECMAScript 模块\",它需要运行环境支持 import 和 export 语法。\n\n * 示例:\n\n\n\n\nformat: cjs#\n\ncjs 代表 \"CommonJS\",它需要运行环境支持 exports、require 和 module 语法,通常为 Node.js 环境。\n\n * 示例:\n\n\n\n\nformat: iife#\n\niife 代表 \"立即调用函数表达式\",它将代码包裹在函数表达式中,确保代码中的任何变量不会意外地与全局范围中的变量冲突,通常在浏览器环境中运行。\n\n * 示例:\n\n\n\n\nformat: umd#\n\numd 代表 \"Universal Module Definition\",用于在不同环境(浏览器、Node.js 等)中运行。umd\n格式的模块可以在多种环境下使用,既可以作为全局变量访问,也可以通过模块加载器(如 RequireJS)进行模块化加载。\n\n * 示例:\n\n\n\n\nhooks#\n\n构建生命周期钩子,允许在构建流程的特定阶段注入自定义逻辑。\n\n * 类型:\n\n\n\n * 默认值:[]\n\n我们可以在 apply 方法里拿到 compiler 实例,修改其属性,以及在不同阶段执行自定义逻辑,对于 Hook 的详细介绍, 参考使用 Hook\n介入构建流程。\n\n\n\n\ninput#\n\n指定构建的入口文件,数组形式可以指定目录。\n\n * 类型:\n\n\n\n * 默认值:bundle 模式下默认为 ['src/index.ts'],bundleless 模式下默认为 ['src']\n\n数组用法:\n\n在 bundle 模式下,下面的配置会以 src/index.ts 和 src/index2.ts 为入口分别进行构建。bundle 模式不支持配置 input\n为目录。\n\n\n\n在 bundleless 模式下,下面的配置会同时处理 src/a 目录下的文件和 src/index.ts 文件。\n\n\n\n在 bundleless 模式下,数组模式还支持使用 ! 来过滤部分文件:\n\n\n\n上面的配置将打包 src 目录下的文件,同时会过滤以 spec.ts 为后缀的文件。这在测试文件与源码文件在同一个根目录下的情况会很有用。\n\n对象用法:\n\n当在 bundle 模式下需要修改产物的输出文件名称的时候,可以使用对象形式进行配置。\n\n对象的 Key 是产物的文件名称,Value 是源码的文件路径。\n\n\n\n\njsx#\n\n指定 JSX 的编译方式,默认支持 React 17 及更高版本,自动注入 JSX 运行时代码。\n\n * 类型: automatic | transform | preserve\n * 默认值: automatic\n\n如果你需要支持 React 16,则可以设置 jsx 为 transform:\n\n\n\nTIP\n\n如果你不需要转换 JSX ,可以设置 jsx 为 preserve, 但此时请不要使用 swc 做代码转换。 关于 JSX Transform\n的更多说明,可以参考以下链接:\n\n * React Blog - Introducing the New JSX Transform.\n * esbuild - JSX.\n\n\nmetafile#\n\n这个选项用于构建分析,开启该选项后,esbuild 会以 JSON 格式生成有关构建的一些元数据。\n\n * 类型:boolean\n * 默认值:false\n * 构建类型:仅支持 buildType: 'bundle'\n\n开启 metafile 生成:\n\n\n\n在执行 build 构建后,产物目录下会生成 metafile-[xxx].json 文件,你可以通过 esbuild analyze 和\nbundle-buddy 等工具进行可视化分析。\n\n\nminify#\n\n使用 esbuild 或者 terser 压缩代码,也可以传入 terserOptions。\n\n * 类型: 'terser' | 'esbuild' | false | object\n * 默认值: false\n\n\n\n\noutDir#\n\n指定构建的输出目录。\n\n * 类型: string\n * 默认值: ./dist\n\n\n\n\nplatform#\n\n默认生成用于 Node.js 环境下的代码,你也可以指定为 browser,会生成用于浏览器环境的代码。 查看esbuild.platform了解更多。\n\n * 类型: 'browser' | 'node'\n * 默认值: 'node'\n\n\n\n\nredirect#\n\n在 buildType: 'bundleless' 构建模式下,会对引用路径进行重定向,确保指向了正确的产物,例如:\n\n * import './index.less' 会被改写成 import './index.css'\n * 会被改写成 (依实际情况而定)\n * 会被改写成 (如果生成了 utils.mjs,视实际情况而定)\n\n在某些场景下,你可能不需要这些功能,那么可以通过此配置关闭它,关闭后,其引用路径将不会发生改变。\n\n\n\n\nresolve#\n\n自定义模块解析选项\n\n\nresolve.alias#\n\n基本用法和 alias 一致。\n\nalias 的问题在于我们在 bundleless 场景下错误的处理了 Module ID 的情况:\n\n\n\n当我们配置了 alias: { react: 'react-native' } 后,结果会变成\n\n\n\n一个 Module ID 被错误的处理成了相对路径,显然这是不符合预期的。\n\n我们想要修复这个问题,但是这可能会破坏已有的项目,因此我们在 2.58.0 版本提供了 resolve.alias 来解决这个问题。 并且\nresolve.alias 里移除了 alias 提供的默认值 { \"@\": \"./src\"}\n\n如果你需要此功能,请使用 resolve.alias。\n\n在下一个大版本,resolve.alias 将会取代 alias 。\n\nWARNING\n * 注意此配置不要与 alias 混用。\n * 注意此配置必须标注一个相对路径,例如 { \"@\": \"./src\" } 而非 { \"@\": \"src\"}。\n\n\nresolve.mainFields#\n\npackage.json 中,在解析包的入口点时尝试的字段列表。\n\n * 类型:string[]\n * 默认值:取决于platform\n * node: ['module', 'main']\n * browser: ['module', 'browser', 'main']\n * 版本:>=2.36.0\n\n例如,我们想要先加载 js:source 字段:\n\n\n\nWARNING\n\nresolve.mainFields 比 package.json 中 exports 字段的优先级低,如果一个入口点从 exports\n成功解析,resolve.mainFields 将被忽略。\n\n\nresolve.jsExtentions#\n\n支持隐式文件扩展名\n\n * 类型: string[]\n * 默认值: ['.jsx', '.tsx', '.js', '.ts', '.json']\n * 版本:>=2.36.0\n\n对于 css 文件,请不要使用隐式文件扩展名,目前 Module 仅支持 ['.less', '.css', '.sass', '.scss'] 后缀。\n\nNode 的解析算法不会将 .mjs 和 cjs 视为隐式文件扩展名,因此这里默认也不会,但是可以通过更改此配置来包含:\n\n\n\n\nshims#\n\n在构建 cjs / esm 产物时注入一些垫片代码。\n\n例如 __dirname 只能在 commonjs 里使用,开启此选项后,当产物格式为 esm 时,会将 __dirname 编译为\npath.dirname(fileURLToPath(import.meta.url))。\n\n详细代码见 shims, 需要注意的是 esm shims 只会在 platform 为 node 时注入,因为用到了 url 模块。\n\n * 类型: boolean\n * 默认值: false\n * 版本:>=2.38.0\n\n\n\n\nsideEffects#\n\n配置模块的副作用\n\n * 类型: RegExg[] | (filePath: string, isExternal: boolean) => boolean | boolean\n * 默认值: undefined\n\n通常情况下,我们通过 package.json 的 \"sideEffects\" 字段来配置模块的副作用,但是在某些情况下,三方包的 package.json\n是不可靠的。 例如我们引用了一个三方包的样式文件。\n\n\n\n但是这个三方包的 package.json 里并没有将样式文件配置到 \"sideEffects\" 里。\n\n\n\n同时你又设置了 style.inject 为 true,在控制台可以看到类似的警告信息:\n\n\n\n这时候就可以使用这个配置项,手动配置模块的\"sideEffects\",配置支持正则和函数形式。\n\n\n\nTIP\n\n添加此配置后,打包时将不会再读取 package.json 里的 \"sideEffects\" 字段。\n\n\nsourceDir#\n\n指定构建的源码目录,默认为 src,用于在 bundleless 构建时基于源码目录结构生成对应的产物目录。 等同于esbuild.outbase。\n\n * 类型: string\n * 默认值: src\n\n\nsourceMap#\n\n控制 sourceMap 如何生成。\n\n * 类型: boolean | 'inline' | 'external'\n * 默认值: false\n\n\nsourceType#\n\nWARNING\n\n已废弃,此配置不会产生任何影响。\n\n设置源码的格式。默认情况下,会将源码作为 EsModule 进行处理。当源码使用的是 CommonJS 的时候,需要设置 commonjs。\n\n * 类型:'commonjs' | 'module'\n * 默认值:'module'\n\n\nsplitting#\n\n是否开启代码分割。 仅支持 format: 'esm' 和 format: 'cjs',查看esbuild.splitting了解更多。\n\n * 类型: boolean\n * 默认值: false\n\n\nstyle#\n\n配置样式相关的配置。\n\n\nstyle.less#\n\nless 相关配置。\n\n\nstyle.less.lessOptions#\n\n详细配置参考 less。\n\n * 类型: object\n * 默认值: { javascriptEnabled: true }\n\n\nstyle.less.additionalData#\n\n在入口文件起始添加 Less 代码。\n\n * 类型: string\n * 默认值: undefined\n\n\n\n\nstyle.less.implementation#\n\n配置 Less 使用的实现库,在不指定的情况下,使用的内置版本是 4.1.3。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置 object 类型时,可以指定 Less 的实现库。\n\n\n\nstring 类型时,指定 Less 的实现库的路径\n\n\n\n\nsass#\n\nSass 相关配置。\n\n\nstyle.sass.sassOptions#\n\n详细配置参考 node-sass\n\n * 类型: object\n * 默认值: {}\n\n\nstyle.sass.additionalData#\n\n在入口文件起始添加 Sass 代码。\n\n * 类型: string | Function\n * 默认值: undefined\n\n\n\n\nstyle.sass.implementation#\n\n配置 Sass 使用的实现库,在不指定的情况下,使用的内置版本是 1.5.4。\n\n * 类型: string | object\n * 默认值: undefined\n\n设置为 object 类型时,可以指定 Sass 的实现库。\n\n\n\nstring 类型时,指定 Sass 的实现库的路径\n\n\n\n\nstyle.postcss#\n\n用于配置 PostCSS 的选项,传入的值会与默认配置通过 Object.assign 合并。注意 Object.assign 是浅拷贝,因此会完全覆盖内置的\nplugins 数组。\n\n详细配置请查看 PostCSS。\n\n * 类型:\n\n\n\n * 默认值:\n\n\n\n * 示例:\n\n\n\n\nstyle.inject#\n\n配置打包模式下是否将 CSS 样式插入到 JavaScript 代码中。\n\n * 类型: boolean\n * 默认值: false\n\n将 inject 设置为 true 来开启此功能:\n\n\n\n开启后,你会看到源码中引用的 CSS 代码被包含在了打包后的 JS 产物中。\n\n例如,你在源码里写了 import './index.scss',那么在产物中你会看到以下代码:\n\n\n\nTIP\n\n开启 inject 后,你需要注意以下几点:\n\n * CSS 文件中的 @import 不会被处理。如果你的 CSS 文件中有 @import ,那么你需要在 JS 文件中手动引入 CSS\n 文件(less,scss 文件不需要,因为它们会有预处理)。\n * 需要考虑 sideEffects 的影响。默认情况下,我们的构建器会认为 CSS 是有副作用的,如果你的项目中或者三方包的 package.json\n 设置了 sideEffects 字段并且没有包含此 CSS 文件,那么你将会得到一个警告:\n\n\n\n此时可以通过配置 sideEffects 来解决。\n\n\nstyle.autoModules#\n\n根据文件名自动启用 CSS Modules。\n\n * 类型: boolean | RegExp\n * 默认值: true\n\ntrue : 为以 .module.css .module.less .module.scss .module.sass 文件名结尾的样式文件启用 CSS\nModules。\n\nfalse : 禁用 CSS Modules.\n\nRegExp : 为匹配正则条件的所有文件启用 CSS Modules.\n\n\nstyle.modules#\n\nCSS Modules 配置。\n\n * 类型: object\n * 默认值: {}\n\n一个常用的配置是 localsConvention,它可以改变 CSS Modules 的类名生成规则。\n\n\n\n对于以下样式:\n\n\n\n你可以使用 styles.boxTitle 来访问。\n\n详细配置查看 postcss-modules\n\n\nstyle.tailwindcss#\n\n用于修改 Tailwind CSS 的配置项。\n\n * 类型: object | Function\n * 默认值:\n\n\n\n\n启用 Tailwind CSS#\n\n在使用 style.tailwindcss 之前,你需要启用 Modern.js Module 的 Tailwind CSS 插件。\n\n请阅读「使用 Tailwind CSS」 章节来了解开启方式。\n\n\n类型#\n\n值为 object 类型时,与默认配置通过 Object.assign 合并。\n\n值为 Function 类型时,函数返回的对象与默认配置通过 Object.assign 合并。\n\n其他的使用方式和 Tailwind CSS 一致: 快速传送门。\n\n\n注意事项#\n\n注意:\n\n * 如果你同时使用了 tailwind.config.{ts,js} 文件和 tools.tailwindcss 选项,那么\n tools.tailwindcss 定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n * 如果你同时使用了 designSystem 配置项,那么 Tailwind CSS 的 theme 配置将会被 designSystem 的值所覆盖。\n\n其他配置的使用方式与 Tailwind CSS 官方用法一致,请参考 tailwindcss - Configuration。\n\n\ntarget#\n\ntarget 用于为生成的 JavaScript 代码设置目标环境。它让 Modern.js Module 将目标环境无法识别的 JavaScript\n语法转换为在这些环境中可用的低版本 JavaScript 语法。\n\n * 类型:\n\n\n\n * 默认值: 'es6'\n\n例如,将代码编译到 es5 语法:\n\n\n\n\ntransformImport#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现,使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:object[]\n * 默认值:[]\n\n数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n参考「Import 插件——注意事项」\n\n\ntransformLodash#\n\n是否模块化 lodash 的导入,删除未使用的 lodash 模块,从而减少 lodash 代码体积。这项优化基于 babel-plugin-lodash 和\nswc-plugin-lodash 实现。 使用此配置,将会使用 SWC 对代码进行转换。\n\n * 类型:boolean\n * 默认值:false\n\n当开启此选项时,Modern.js Module 会自动将 lodash 的代码引用指向子路径。\n\n比如:\n\n\n\n转换后的代码:\n\n\n\n\ntsconfig#\n\nTypeScript 配置文件的路径。\n\n * 类型: string\n * 默认值: tsconfig.json\n * 版本: >=2.36.0\n\n\n\n\numdGlobals#\n\n指定 UMD 产物外部导入的全局变量。\n\n * 类型: Record\n * 默认值: {}\n\n\n\n此时,react 和 react-dom 会被看做是外部导入的全局变量,不会被打包进 UMD 产物中,而是通过 global.React 和\nglobal.ReactDOM 的方式进行访问。\n\n\numdModuleName#\n\n指定 UMD 产物的模块名。\n\n * 类型: string | Function\n * 默认值: name => name\n\n\n\n此时 UMD 产物会去挂载到 global.myLib 上。\n\nTIP\n * 需要遵守 UMD 规范,UMD 产物的模块名不能和全局变量名冲突。\n * 模块名会被转换为驼峰命名,如 my-lib 会被转换为 myLib,可参考toIdentifier。\n\n同时函数形式可以接收一个参数,为当前打包文件的输出路径\n\n","routePath":"/module-tools/api/config/build-config","lang":"zh","toc":[{"text":"alias","id":"alias","depth":2,"charIndex":141},{"text":"asset","id":"asset","depth":2,"charIndex":483},{"text":"asset.name","id":"assetname","depth":2,"charIndex":506},{"text":"asset.limit","id":"assetlimit","depth":2,"charIndex":753},{"text":"asset.path","id":"assetpath","depth":2,"charIndex":981},{"text":"asset.publicPath","id":"assetpublicpath","depth":2,"charIndex":1052},{"text":"asset.svgr","id":"assetsvgr","depth":2,"charIndex":1159},{"text":"asset.svgr.include","id":"assetsvgrinclude","depth":2,"charIndex":1411},{"text":"asset.svgr.exclude","id":"assetsvgrexclude","depth":2,"charIndex":1510},{"text":"asset.svgr.exportType","id":"assetsvgrexporttype","depth":2,"charIndex":1611},{"text":"autoExtension","id":"autoextension","depth":2,"charIndex":1802},{"text":"autoExternal","id":"autoexternal","depth":2,"charIndex":2393},{"text":"autoExternal.dependencies","id":"autoexternaldependencies","depth":2,"charIndex":2670},{"text":"autoExternal.peerDependencies","id":"autoexternalpeerdependencies","depth":2,"charIndex":2758},{"text":"banner","id":"banner","depth":2,"charIndex":2854},{"text":"buildType","id":"buildtype","depth":2,"charIndex":2984},{"text":"copy","id":"copy","depth":2,"charIndex":3087},{"text":"copy.patterns","id":"copypatterns","depth":2,"charIndex":3128},{"text":"copy.options","id":"copyoptions","depth":2,"charIndex":3180},{"text":"define","id":"define","depth":2,"charIndex":3341},{"text":"dts","id":"dts","depth":2,"charIndex":3802},{"text":"dts.abortOnError","id":"dtsabortonerror","depth":2,"charIndex":3864},{"text":"dts.distPath","id":"dtsdistpath","depth":2,"charIndex":4097},{"text":"dts.enableTscBuild","id":"dtsenabletscbuild","depth":2,"charIndex":4196},{"text":"dts.only","id":"dtsonly","depth":2,"charIndex":4419},{"text":"dts.respectExternal","id":"dtsrespectexternal","depth":2,"charIndex":4499},{"text":"dts.tsconfigPath","id":"dtstsconfigpath","depth":2,"charIndex":4718},{"text":"esbuildOptions","id":"esbuildoptions","depth":2,"charIndex":4790},{"text":"externalHelpers","id":"externalhelpers","depth":2,"charIndex":5293},{"text":"externals","id":"externals","depth":2,"charIndex":5501},{"text":"footer","id":"footer","depth":2,"charIndex":5617},{"text":"format","id":"format","depth":2,"charIndex":5655},{"text":"format: esm","id":"format-esm","depth":3,"charIndex":5780},{"text":"format: cjs","id":"format-cjs","depth":3,"charIndex":5859},{"text":"format: iife","id":"format-iife","depth":3,"charIndex":5957},{"text":"format: umd","id":"format-umd","depth":3,"charIndex":6058},{"text":"hooks","id":"hooks","depth":2,"charIndex":6211},{"text":"input","id":"input","depth":2,"charIndex":6359},{"text":"jsx","id":"jsx","depth":2,"charIndex":6824},{"text":"metafile","id":"metafile","depth":2,"charIndex":7147},{"text":"minify","id":"minify","depth":2,"charIndex":7385},{"text":"outDir","id":"outdir","depth":2,"charIndex":7505},{"text":"platform","id":"platform","depth":2,"charIndex":7559},{"text":"redirect","id":"redirect","depth":2,"charIndex":7693},{"text":"resolve","id":"resolve","depth":2,"charIndex":7924},{"text":"resolve.alias","id":"resolvealias","depth":3,"charIndex":7946},{"text":"resolve.mainFields","id":"resolvemainfields","depth":3,"charIndex":8396},{"text":"resolve.jsExtentions","id":"resolvejsextentions","depth":3,"charIndex":8713},{"text":"shims","id":"shims","depth":2,"charIndex":8970},{"text":"sideEffects","id":"sideeffects","depth":2,"charIndex":9237},{"text":"sourceDir","id":"sourcedir","depth":2,"charIndex":9679},{"text":"sourceMap","id":"sourcemap","depth":2,"charIndex":9795},{"text":"sourceType","id":"sourcetype","depth":2,"charIndex":9882},{"text":"splitting","id":"splitting","depth":2,"charIndex":10040},{"text":"style","id":"style","depth":2,"charIndex":10153},{"text":"style.less","id":"styleless","depth":2,"charIndex":10174},{"text":"style.less.lessOptions","id":"stylelesslessoptions","depth":2,"charIndex":10200},{"text":"style.less.additionalData","id":"stylelessadditionaldata","depth":2,"charIndex":10291},{"text":"style.less.implementation","id":"stylelessimplementation","depth":2,"charIndex":10375},{"text":"sass","id":"sass","depth":2,"charIndex":10550},{"text":"style.sass.sassOptions","id":"stylesasssassoptions","depth":2,"charIndex":10570},{"text":"style.sass.additionalData","id":"stylesassadditionaldata","depth":2,"charIndex":10640},{"text":"style.sass.implementation","id":"stylesassimplementation","depth":2,"charIndex":10735},{"text":"style.postcss","id":"stylepostcss","depth":2,"charIndex":10911},{"text":"style.inject","id":"styleinject","depth":2,"charIndex":11070},{"text":"style.autoModules","id":"styleautomodules","depth":2,"charIndex":11566},{"text":"style.modules","id":"stylemodules","depth":2,"charIndex":11800},{"text":"style.tailwindcss","id":"styletailwindcss","depth":2,"charIndex":11979},{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":3,"charIndex":12061},{"text":"类型","id":"类型","depth":3,"charIndex":12181},{"text":"注意事项","id":"注意事项","depth":3,"charIndex":12312},{"text":"target","id":"target","depth":2,"charIndex":12602},{"text":"transformImport","id":"transformimport","depth":2,"charIndex":12768},{"text":"transformLodash","id":"transformlodash","depth":2,"charIndex":12964},{"text":"tsconfig","id":"tsconfig","depth":2,"charIndex":13206},{"text":"umdGlobals","id":"umdglobals","depth":2,"charIndex":13294},{"text":"umdModuleName","id":"umdmodulename","depth":2,"charIndex":13454}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":47,"title":"buildPreset","content":"#\n\n构建的预设字符串或者预设函数。提供开箱即用的构建配置。\n\n * 类型:string | Function\n\n * 默认值: undefined\n\n\nnpm-library#\n\n在类 NPM 包管理器下使用的 Library 通用模式,包含 esm 和 cjs 两种 Bundle 产物,并且包含一份类型文件。\n\nINFO\n\n关于类 NPM 包管理器\n\n * npm\n * yarn\n * pnpm\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-library-with-umd#\n\n在类 NPM 包管理器下使用,并且 Library 支持类似 unpkg 的模式。在预设 'npm-library' 的基础上,额外提供 umd 产物。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component#\n\n在类 NPM 包管理器下使用的 组件(库)通用模式。包含 esm 和 cjs 两种 Bundleless 产物(便于 Tree shaking\n优化),以及包含一份类型文件。\n\n对于源码中包含的样式文件,产物中提供样式的编译产物和样式的源文件。\n\n\n\n预设字符串对应的构建配置:\n\n\n\n\nnpm-component-with-umd#\n\n在类 NPM 包管理器下使用的组件(库),同时支持类 unpkg 的模式。 在预设 'npm-component' 的基础上,额外提供 umd 产物。\n\n\n\n\n\n\nnpm-library-{es5...esnext}#\n\n当想要使用支持其他 ECMAScript 版本的 buildPreset 预设的时候,可以直接在\n'npm-library'、'npm-library-with-umd'、'npm-component'、'npm-component-with-umd'\n这些预设值后面增加想要支持的版本。\n\n例如希望 'npm-library' 预设支持 'es2017',则可以按照如下方式配置:\n\n\n\n\nstring / function#\n\nbuildPreset 除了支持基本的字符串形式,还支持函数形式,可以通过 preset 或者 extendPreset\n参数获取我们提供的预设值,然后进行修改。\n\n以下是两个分别使用 preset 和 extendPreset 的例子:\n\n\n\nextendPreset 里会使用 lodash.merge 进行配置合并\n\n","routePath":"/module-tools/api/config/build-preset","lang":"zh","toc":[{"text":"`npm-library`","id":"npm-library","depth":2,"charIndex":-1},{"text":"`npm-library-with-umd`","id":"npm-library-with-umd","depth":2,"charIndex":-1},{"text":"`npm-component`","id":"npm-component","depth":2,"charIndex":-1},{"text":"`npm-component-with-umd`","id":"npm-component-with-umd","depth":2,"charIndex":-1},{"text":"`npm-library-{es5...esnext}`","id":"npm-library-es5esnext","depth":2,"charIndex":-1},{"text":"string / function","id":"string--function","depth":2,"charIndex":835}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":48,"title":"dev","content":"#\n\n本章节描述了 Modern.js Module 关于调试工具相关的所有配置。\n\n\nstorybook#\n\nWARNING\n\nDeprecated:该配置已过时,只适用于 StorybookV6,详情请看使用Storybook。\n\n\nstorybook.webpack#\n\n * 类型:object | Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpack 来修改 Storybook Preview-iframe 的 webpack 配置。使用方式可以参考\nModern.js Builder 的 tools.webpack 配置。\n\n\n\n配置 Manager App#\n\n对于 Storybook Manager App 部分的 webpack 配置,可以通过增加 ./config/storybook/main.js\n文件进行配置。\n\n\n\n\nstorybook.webpackChain#\n\n * 类型:Function | undefined\n * 默认值:undefined\n\n\n\n你可以通过 dev.storybook.webpackChain 来修改 Storybook Preview-iframe 的 webpack\n配置。使用方式可以参考 Modern.js Builder 的 tools.webpackChain 配置。","routePath":"/module-tools/api/config/dev","lang":"zh","toc":[{"text":"storybook","id":"storybook","depth":2,"charIndex":43},{"text":"storybook.webpack","id":"storybookwebpack","depth":3,"charIndex":118},{"text":"配置 Manager App","id":"配置-manager-app","depth":4,"charIndex":314},{"text":"storybook.webpackChain","id":"storybookwebpackchain","depth":3,"charIndex":417}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":49,"title":"plugins","content":"#\n\n本章介绍注册 Modern.js Module 插件的配置。\n\n * 类型:ModuleToolsPlugin[]\n * 默认值:undefined\n\n\n插件执行顺序#\n\n默认情况下,自定义插件会按照 plugins 数组的顺序依次执行,Modern.js Module 内置插件的执行时机早于自定义插件。\n\n当插件内部使用了控制顺序的相关字段,比如 pre、post 时,会基于声明的字段对执行顺序进行调整,详见 插件之间的关系。\n\n\n开发插件#\n\n关于如何编写插件,可以查看「插件编写指南」。\n\n\n示例#\n\n\n使用 npm 上的插件#\n\n使用 npm 上的插件,需要通过包管理器安装插件,并通过 import 引入。\n\n\n\n使用本地插件#\n\n使用本地代码仓库中的插件,直接通过相对路径 import 引入即可。\n\n\n\n\n插件配置项#\n\n如果插件提供了一些自定义的配置项,你可以通过插件函数的参数传入配置。\n\n","routePath":"/module-tools/api/config/plugins","lang":"zh","toc":[{"text":"插件执行顺序","id":"插件执行顺序","depth":2,"charIndex":79},{"text":"开发插件","id":"开发插件","depth":2,"charIndex":221},{"text":"示例","id":"示例","depth":2,"charIndex":253},{"text":"使用 npm 上的插件","id":"使用-npm-上的插件","depth":3,"charIndex":259},{"text":"使用本地插件","id":"使用本地插件","depth":4,"charIndex":316},{"text":"插件配置项","id":"插件配置项","depth":3,"charIndex":364}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":50,"title":"概览","content":"#","routePath":"/module-tools/api/","lang":"zh","toc":[],"domain":"","frontmatter":{"overview":true,"sidebar_label":"概览","sidebar_position":1},"version":""},{"id":51,"title":"Plugin Hooks","content":"#\n\n本章介绍关于 Modern.js Module 支持的生命周期钩子。\n\n目前主要包含以下几类生命周期钩子:\n\n * 配置钩子:用于处理用户配置。\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n这里详细解释了 Hook 模型\n\n\n配置钩子#\n\n\nresolveModuleUserConfig#\n\n用于修改用户配置。\n\n类型:AsyncWaterfall\n\n\n\n\n构建钩子#\n\n在执行 build 命令的时候,会按照顺序触发以下 Hooks:\n\n * beforeBuild\n * beforeBuildTask\n * afterBuildTask\n * afterBuild\n\n\nbeforeBuild#\n\n执行整体构建流程之前触发。\n\n类型:ParallelWorkflow\n\n\n\n参数类型:\n\n\n\n> BuildConfig 类型参考 API 配置\n\n\nbeforeBuildTask#\n\n根据构建配置,Modern.js Module 会将整体构建分成多个子构建任务。该 Hook 将会在每一个构建子任务之前触发。\n\n类型:AsyncWaterfall\n\n\n\n\nafterBuildTask#\n\n类型:ParallelWorkflow,每一个构建子任务结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nafterBuild#\n\n类型:ParallelWorkflow,整体构建流程结束之后触发。\n\n\n\n参数和返回值类型:\n\n\n\n\nbuildPlatform 钩子#\n\nmodule-tools 还提供了 build --platform 命令来执行特定的构建任务。\n\n例如在安装了 Doc 插件后,就可以执行 build --platform 或者 build --platform doc 来执行 doc 的构建任务。因为\ndoc 插件基于 buildPlatform Hooks 实现了该功能。\n\n在执行 build --platform 后会按照以下顺序触发 Hooks:\n\n * registerBuildPlatform\n * beforeBuildPlatform\n * buildPlatform\n * afterBuildPlatform\n\n\nregisterBuildPlatform#\n\n获取在执行 build --platform 命令时候需要运行的任务信息。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。beforeBuildPlatform 会在执行整体的构建任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。buildPlatform 会在每个构建任务执行之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterBuildPlatform#\n\n当执行 build --platform 命令的时候,会触发所有已注册的构建任务。afterBuildPlatform 会在整体 platform\n构建任务结束后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n调试钩子#\n\n在执行 dev 命令的时候,会按照顺序触发以下 Hooks:\n\n * registerDev: 在获取调试功能信息的时候触发。\n * beforeDev: 开始执行调试整体流程之前触发。\n * beforeDevMenu: 出现调试列表/菜单之前触发。\n * afterDevMenu: 选择调试列表/菜单选项后触发。\n * beforeDevTask: 执行调试任务之前触发。\n * afterDev: 执行 dev 整体流程最后触发。\n\n\nregisterDev#\n\n注册调试工具相关的数据。主要包含:\n\n * 调试工具的名称\n * 显示在菜单列表中的项目名称以及对应的值。\n * dev 子命令的定义。\n * 是否在运行调试任务之前执行源码构建\n * 执行调试任务的函数。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDev#\n\n在收集完所有调试工具元数据后,执行 dev 任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\n(before|after)DevMenu#\n\nbeforeDevMenu 在出现调试列表/菜单之前触发。接收 inquirer question 作为参数。默认值为:\n\n\n\nafterDevMenu 选择调试列表/菜单选项后触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nbeforeDevTask#\n\n执行调试任务之前触发。\n\n\n\n入参和返回的参数类型:\n\n\n\n\nafterDev#\n\n在中断调试任务进程时触发。\n\n","routePath":"/module-tools/api/plugin-api/plugin-hooks","lang":"zh","toc":[{"text":"配置钩子","id":"配置钩子","depth":2,"charIndex":209},{"text":"`resolveModuleUserConfig`","id":"resolvemoduleuserconfig","depth":3,"charIndex":-1},{"text":"构建钩子","id":"构建钩子","depth":2,"charIndex":276},{"text":"`beforeBuild`","id":"beforebuild","depth":3,"charIndex":-1},{"text":"`beforeBuildTask`","id":"beforebuildtask","depth":3,"charIndex":-1},{"text":"`afterBuildTask`","id":"afterbuildtask","depth":3,"charIndex":-1},{"text":"`afterBuild`","id":"afterbuild","depth":3,"charIndex":-1},{"text":"buildPlatform 钩子","id":"buildplatform-钩子","depth":2,"charIndex":713},{"text":"`registerBuildPlatform`","id":"registerbuildplatform","depth":3,"charIndex":-1},{"text":"`beforeBuildPlatform`","id":"beforebuildplatform","depth":3,"charIndex":-1},{"text":"`buildPlatform`","id":"buildplatform","depth":3,"charIndex":-1},{"text":"`afterBuildPlatform`","id":"afterbuildplatform","depth":3,"charIndex":-1},{"text":"调试钩子","id":"调试钩子","depth":2,"charIndex":1459},{"text":"`registerDev`","id":"registerdev","depth":3,"charIndex":-1},{"text":"`beforeDev`","id":"beforedev","depth":3,"charIndex":-1},{"text":"`(before|after)DevMenu`","id":"beforeafterdevmenu","depth":3,"charIndex":-1},{"text":"`beforeDevTask`","id":"beforedevtask","depth":3,"charIndex":-1},{"text":"`afterDev`","id":"afterdev","depth":3,"charIndex":-1}],"domain":"","frontmatter":{},"version":""},{"id":52,"title":"","content":"","routePath":"/module-tools/components/faq-build-exception","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":53,"title":"","content":"","routePath":"/module-tools/components/faq-build-other","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":54,"title":"","content":"","routePath":"/module-tools/components/faq-build-product","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":55,"title":"","content":"","routePath":"/module-tools/components/faq-storybook","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":56,"title":"","content":"","routePath":"/module-tools/components/publish-emo","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":57,"title":"","content":"在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。","routePath":"/module-tools/components/register-esbuild-plugin","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":58,"title":"","content":"","routePath":"/module-tools/components/release-module-doc","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":59,"title":"处理静态资源","content":"#\n\nModern.js Module 会对代码中使用的静态资源进行处理。如果需要配置,则可以使用 buildConfig.asset API。\n\n\n默认行为#\n\n默认情况下,Modern.js Module 会处理以下静态资源:\n\n * '.svg'、'.png'、'.jpg'、'.jpeg'、'.gif'、'.webp'\n * '.ttf'、'.otf'、'.woff'、'.woff2'、'.eot'\n * '.mp3'、'.mp4'、'.webm'、'.ogg'、'.wav'、'.flac'、'.aac'、'.mov'\n\n对于静态文件的处理,Modern.js Module 目前默认支持的功能有:\n\n * 输出静态资源至 ./assets。\n * 对于不超过 10kb 的文件会内联到代码中。\n\n\n示例#\n\n让我们看下面的例子:\n\n * 项目源代码:\n\n\n\n * 如果 bg.png 的大小小于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n * 如果 bg.png 的大小大于 10 kb,则此时产物目录结构和产物内容为:\n\n\n\n\n\n当你想要修改默认行为的时候,可以使用以下 API:\n\n * asset.path:修改静态资源文件输出路径。\n * asset.limit:修改内联静态资源文件的阈值。","routePath":"/module-tools/guide/advance/asset","lang":"zh","toc":[{"text":"默认行为","id":"默认行为","depth":2,"charIndex":74},{"text":"示例","id":"示例","depth":2,"charIndex":355}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":60,"title":"构建 umd 产物","content":"#\n\numd 全称为 Universal Module Definition,这种格式的 JS 文件可以运行在多个运行环境:\n\n * 浏览器环境:基于 AMD 规范进行模块加载\n * Node.js 环境:基于 CommonJS 进行模块加载\n * 其他情况:将模块挂载在全局对象上。\n\n因此我们可以通过下面的方式,将项目的构建产物指定为 umd 产物:\n\n\n\n\numd 产物的第三方依赖处理#\n\n在 「如何处理第三方依赖」 章节中,我们知道可以通过 autoExternals 和 externals API 来控制项目是否对第三方依赖打包。 因此在构建\numd 产物的过程中,我们也可以这样使用:\n\n\n示例#\n\n * 如果项目依赖了 react:\n\n\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时产物中不会将 react 代码打包到产物中:\n\n\n\n通过上面的例子我们知道,当使用 autoExternal 和 externals API 后:\n\n * 在 Node.js 环境下,可以通过 require('react') 获取 react 依赖。\n * 在 浏览器环境下,可以通过 global.react 获取 react 依赖。\n\n\n三方依赖的全局变量名称#\n\n然而在浏览器环境下,获取第三方依赖的时候,全局变量名称不一定与依赖名称完全相同,此时就要使用 buildConfig.umdGlobals API。\n\n还是使用之前的例子,当 react 依赖以 windows.React 或者 global.React 全局变量的形式存在于浏览器环境下,那么此时:\n\n * modern.config.ts 配置:\n\n\n\n * 当源码中使用了 react 依赖:\n\n\n\n * 此时我们会看到这样的产物代码:\n\n\n\n此时项目就可以运行在浏览器中,并使用存在于全局对象上的 React 变量了。\n\n\n更改项目的全局变量名称#\n\n当我们将下面的代码打包成 umd 产物并运行在浏览器的时候,我们可以通过 window.index 来使用该模块。\n\n\n\n默认情况下,以源码文件名称作为该模块在浏览器里全局变量的名称。对于上面的例子,其产物内容如下:\n\n\n\n如果需要修改它,则需要使用 buildConfig.umdModuleName API。\n\n当使用该 API 后:\n\n\n\n此时构建产物的内容为:\n\n","routePath":"/module-tools/guide/advance/build-umd","lang":"zh","toc":[{"text":"umd 产物的第三方依赖处理","id":"umd-产物的第三方依赖处理","depth":2,"charIndex":181},{"text":"示例","id":"示例","depth":3,"charIndex":302},{"text":"三方依赖的全局变量名称","id":"三方依赖的全局变量名称","depth":3,"charIndex":556},{"text":"更改项目的全局变量名称","id":"更改项目的全局变量名称","depth":2,"charIndex":836}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":61,"title":"使用 Copy 工具","content":"#\n\nModern.js Module 提供了 Copy 工具用于将已经存在的单个文件或整个目录复制到产物目录中。接下来我们学习如何使用它。\n\n\n了解 Copy API#\n\n我们可以通过 buildConfig.copy API 来使用 Copy 工具,它包含以下两个主要配置:\n\n * patterns\n * options\n\n\nAPI 详解#\n\ncopy.patterns 用于寻找复制的文件以及配置输出的路径。\n\n其中 patterns.from 用于指定要复制的文件或者目录。它接收 Glob 形式字符串或具体路径。Glob 形式字符串是指 fast-glob\npattern-syntax。因此我们可以按照如下两种方式使用它:\n\n\n\npatterns.context 一般和 patterns.from 配合使用,默认情况下它的值与 buildConfig.sourceDir\n相同,因此我们可以按照如下方式指定 src/data.json 文件为要复制的文件:\n\n> 默认情况下,buildConfig.sourceDir 为 src\n\n\n\n当指定的文件不在源码目录的时候,可以修改 context 配置。例如指定项目目录下的 temp/index.html 为要复制的文件:\n\n\n\npatterns.to 用于指定复制文件的输出路径,默认情况下它的值为 buildConfig.outDir对应的值。因此我们按照如下方式将\nsrc/index.html 复制到 dist 目录下:\n\n\n\n当我们配置了 patterns.to 的时候:\n\n * 如果是相对路径,则该路径会相对于 buildConfig.outDir 计算出复制文件输出的绝对路径。\n * 如果是绝对路径,则会直接使用该值。\n\n最后 patterns.globOptions 用于配置寻找复制文件 globby 对象,其配置可参考:\n\n * globby.options\n\n\n不同场景使用示例#\n\n\n将文件复制文件#\n\n\n\n\n将文件复制到目录#\n\n\n\n\n从目录复制到目录#\n\n\n\n\n从目录到文件#\n\n\n\n\n使用 Glob#\n\n","routePath":"/module-tools/guide/advance/copy","lang":"zh","toc":[{"text":"了解 Copy API","id":"了解-copy-api","depth":2,"charIndex":72},{"text":"API 详解","id":"api-详解","depth":2,"charIndex":165},{"text":"不同场景使用示例","id":"不同场景使用示例","depth":2,"charIndex":826},{"text":"将文件复制文件","id":"将文件复制文件","depth":3,"charIndex":838},{"text":"将文件复制到目录","id":"将文件复制到目录","depth":3,"charIndex":851},{"text":"从目录复制到目录","id":"从目录复制到目录","depth":3,"charIndex":865},{"text":"从目录到文件","id":"从目录到文件","depth":3,"charIndex":879},{"text":"使用 Glob","id":"使用-glob","depth":3,"charIndex":891}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":62,"title":"处理三方依赖","content":"#\n\n一般来说,项目所需要的第三方依赖可以通过包管理器的 install 命令安装,在安装第三方依赖成功后,这些第三方依赖一般会出现在项目 package.json\n的 dependencies 和 devDependencies 下。\n\n\n\n\"dependencies\" 下的依赖通常来说是这个包运行所需的依赖, \"devDependencies\" 则代表着开发依赖。\n\n除了 \"dependencies\" 以外,\"peerDependencies\" 也可以声明在生产环境下运行所需要的依赖,此时会和它的宿主共享一份依赖。\n\n\n第三方依赖的默认处理#\n\n在 Modern.js Module 里,默认情况下不会对 \"dependencies\" 以及 \"peerDependencies\"\n下的第三方依赖进行打包处理。\n\n这是因为在安装 npm 包时,其 \"dependencies\" 也会被安装。不打包 \"dependencies\",可以减小包产物的体积。\n\n如果需要打包某些依赖,建议将它们从 \"dependencies\" 挪到 \"devDependencies\" ,这相当于对依赖进行 prebundle\n,可以减小依赖安装的体积。\n\n\n示例#\n\n如果项目依赖了 react:\n\n\n\n当源码中使用了 react 依赖:\n\n\n\n此时产物中不会包含 react 的代码:\n\n\n\n如果想要修改默认的处理方式,可以通过下面的 API 进行修改:\n\n * buildConfig.autoExternal\n\n\n排除指定第三方依赖#\n\n在上面我们提到了 buildConfig.autoExternal API 的用途,同时 buildConfig.externals\n可以实现对三方依赖更细微的处理。\n\n例如当我们需要仅对某些依赖不进行打包处理的时候,可以按照如下方式进行配置:\n\n> 一般这种情况,可能是某些依赖不适合进行打包处理。如果遇到这种情况,则可以按照下面的方式进行处理。\n\n","routePath":"/module-tools/guide/advance/external-dependency","lang":"zh","toc":[{"text":"第三方依赖的默认处理","id":"第三方依赖的默认处理","depth":2,"charIndex":264},{"text":"示例","id":"示例","depth":3,"charIndex":521},{"text":"排除指定第三方依赖","id":"排除指定第三方依赖","depth":2,"charIndex":652}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":63,"title":"深入理解构建","content":"#\n\n在 \"基础使用\" 的部分,我们已经知道可以通过 buildConfig 配置对项目的输出产物进行修改。buildConfig\n不仅描述了产物的一些特性,同时还为构建产物提供了一些功能。\n\nTIP\n\n如果你还不了解 buildConfig 的作用,请先阅读 修改输出产物。\n\n而在本章里我们将要深入理解某些构建配置的作用以及了解执行 modern build 命令的时候发生了什么。\n\n\nbundle / bundleless#\n\n那么首先我们来了解一下 bundle 和 bundleless。\n\n所谓 bundle 是指对构建产物进行打包,构建产物可能是一个文件,也有可能是基于一定的代码拆分策略得到的多个文件。\n\n而 bundleless 则是指对每个源文件单独进行编译构建,但是并不将它们打包在一起。每一个产物文件都可以找到与之相对应的源码文件。bundleless\n构建的过程,也可以理解为仅对源文件进行代码转换的过程。\n\n它们有各自的好处:\n\n * bundle 可以减少构建产物的体积,也可以对依赖预打包,减小安装依赖的体积。提前对库进行打包,可以加快应用项目构建的速度。\n * bundleless 则是可以保持原有的文件结构,更有利于调试和 tree shaking。\n\nWARNING\n\nbundleless 是单文件编译模式,因此对于类型的引用和导出你需要加上 type 字段, 例如 import type { A } from\n'./types,背景参考 esbuild 文档。\n\n在 buildConfig 中可以通过 buildConfig.buildType 来指定当前构建任务是 bundle 还是 bundleless。\n\n\ninput / sourceDir#\n\nbuildConfig.input 用于指定读取源码的文件路径或者目录路径,其默认值在 bundle 和 bundleless 构建过程中有所不同:\n\n * 当 buildType: 'bundle' 的时候,input 默认值为 src/index.(j|t)sx?\n * 当 buildType: 'bundleless' 的时候,input 默认值为 ['src']\n\n从默认值上我们可以知道:使用 bundle 模式构建时一般指定一个或多个文件作为构建的入口,而使用 bundleless\n构建则是指定一个目录,将目录下所有文件作为入口。\n\nsourceDir 用于指定源码目录,它只与以下两个内容有关系:\n\n * 类型文件生成\n * 指定构建过程中的 outbase\n\n因此我们可以得到其最佳实践:\n\n * 在 bundle 构建过程中,只能指定 input 。\n * 一般情况下,bundleless 只需要指定 sourceDir(此时 input 会与 sourceDir 保持一致)。\n\n如果我们想要在 bundleless 里只对一部分文件进行转换,例如只需要转换 src/runtime 目录的文件,此时需要配置 input:\n\n\n\n\n使用 swc#\n\n在部分场景下,esbuild 不足以满足我们的需求,此时我们会使用 swc 来做代码转换。\n\n从 2.36.0 版本开始,涉及到以下功能时,Modern.js Module 默认会使用 swc ,但不这意味着不使用 esbuild 了,其余功能还是使用\nesbuild:\n\n * transformImport\n * transformLodash\n * externalHelpers\n * format: umd\n * target: es5\n * emitDecoratorMetadata: true\n\n事实上,我们在 2.16.0 版本开始全量使用 swc 进行代码转换。不过 swc 同样也存在一些限制,为此我们添加了 sourceType 配置,当源码格式为\n'commonjs' 时关闭 swc, 但这种方式并不符合用户直觉,另外,swc 格式化输出的 cjs 模式没有给每个导出名称添加注释,这在 node\n中使用可能会带来一些问题。 因为我们废弃了此行为,回到了最初的设计 - 只在需要的场景下使用 swc 作为补充。\n\n\n使用 Hook 介入构建流程#\n\nModern.js Module 提供了 Hook 机制,允许我们在构建流程的不同阶段注入自定义逻辑。 Modern.js Module Hook 使用了\ntapable 实现,扩展了 esbuild 的插件机制,若 esbuild plugins 已经满足了你的需求,建议直接使用它。 下面展开说明其用法:\n\n\nHook 类型#\n\nAsyncSeriesBailHook#\n\n串行执行的 hooks,如果某个 tapped function 返回非 undefined 结果,则后续其他的 tapped function 停止执行。\n\nAsyncSeriesWaterFallHooks#\n\n串行执行的 hooks,其结果会传递给下一个 tapped function\n\n\nHook API#\n\nload#\n\n * AsyncSeriesBailHook\n * 在 esbuild onLoad callbacks 触发,根据模块路径来获取模块内容\n * 输入参数\n\n\n\n * 返回参数\n\n\n\n * 例子\n\n\n\ntransform#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onLoad callbacks 触发, 将 load 阶段获取的模块内容进行转换\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\nrenderChunk#\n\n * AsyncSeriesWaterFallHooks\n * 在 esbuild onEnd callbacks 触发, 类似于 transform hook,但是作用在 esbuild 生成的产物\n * 输入参数(返回参数)\n\n\n\n * 例子\n\n\n\n\n类型文件生成#\n\nbuildConfig.dts 配置主要用于类型文件的生成。\n\n\n关闭类型生成#\n\n默认情况下类型生成功能是开启的,如果需要关闭的话,可以按照如下配置:\n\n\n\nTIP\n\n关闭类型文件后,一般来说构建速度会有所提升。\n\n\n打包类型文件#\n\n在 buildType: 'bundleless' 的时候,类型文件的生成是使用项目的 tsc 命令来完成生产。\n\nModern.js Module 同时还支持对类型文件进行打包,不过使用该功能的时候需要注意:\n\n * 对类型文件进行打包不会开启类型检查。\n * 一些第三方依赖存在错误的语法会导致打包过程失败。因此对于这种情况,需要手动通过 buildConfig.externals\n 将这类第三方包排除,或者直接关闭dts.respectExternal从而不打包任何三方包类型。\n * 对于第三方依赖的类型文件指向的是一个 .ts 文件的情况,目前无法处理。比如第三方依赖的 package.json 中存在这样的内容: {\"types\":\n \"./src/index.ts\"。\n\n对于上述问题,我们推荐的处理方式是首先使用 tsc 生成 d.ts 文件,然后将 index.d.ts 作为入口进行打包处理,并且关闭\ndts.respectExternal。在之后的演进我们也会逐渐向这种处理方式靠拢。\n\n\n别名转换#\n\n在 bundleless 构建过程中,如果源代码中出现了别名,例如:\n\n\n\n使用 tsc 生成的产物类型文件也会包含这些别名。不过 Modern.js Module 会对 tsc 生成的类型文件里的别名进行转换处理。\n\n\n一些示例#\n\n\n\n\n\n\n构建过程#\n\n当执行 modern build 命令的时候,会发生\n\n * 根据 buildConfig.outDir 清理产物目录。\n * 编译 js/ts 源代码生成 bundle / bundleless 的 JS 构建产物。\n * 使用 tsc 生成 bundle / bundleless 的类型文件。\n * 处理 copy 任务。\n\n\n构建报错#\n\n当发生构建报错的时候,基于以上了解到的信息,可以很容易的明白在终端出现的报错内容:\n\njs 或者 ts 构建的报错:\n\n\n\n类型文件生成过程的报错:\n\n\n\n对于 js/ts 构建错误,我们可以从报错信息中知道:\n\n * 报错的 buildType\n * 报错的 format\n * 报错的 target\n * 其他具体报错信息\n\n\n调试模式#\n\n从 2.36.0 版本开始,为了便于排查问题,Modern.js Module 提供了调试模式,你可以在执行构建时添加 DEBUG=module\n环境变量来开启调试模式。\n\n\n\n调试模式下,你会看到 Shell 中输出更详细的构建日志,这主要以流程日志为主:\n\n\n\n另外,Module 还提供了调试内部工作流程的能力。你可以通过设置环境变量 DEBUG=module:* 来开启更详细的调试日志:\n\n目前只支持了 DEBUG=module:resolve,可以查看 Module 内部模块解析的详细日志:\n\n","routePath":"/module-tools/guide/advance/in-depth-about-build","lang":"zh","toc":[{"text":"`bundle` / `bundleless`","id":"bundle--bundleless","depth":2,"charIndex":-1},{"text":"`input` / `sourceDir`","id":"input--sourcedir","depth":2,"charIndex":-1},{"text":"使用 swc","id":"使用-swc","depth":2,"charIndex":1281},{"text":"使用 Hook 介入构建流程","id":"使用-hook-介入构建流程","depth":2,"charIndex":1762},{"text":"Hook 类型","id":"hook-类型","depth":3,"charIndex":1936},{"text":"AsyncSeriesBailHook","id":"asyncseriesbailhook","depth":4,"charIndex":1946},{"text":"AsyncSeriesWaterFallHooks","id":"asyncserieswaterfallhooks","depth":4,"charIndex":2048},{"text":"Hook API","id":"hook-api","depth":3,"charIndex":2117},{"text":"load","id":"load","depth":4,"charIndex":2128},{"text":"transform","id":"transform","depth":4,"charIndex":2236},{"text":"renderChunk","id":"renderchunk","depth":4,"charIndex":2358},{"text":"类型文件生成","id":"类型文件生成","depth":2,"charIndex":2500},{"text":"关闭类型生成","id":"关闭类型生成","depth":3,"charIndex":2542},{"text":"打包类型文件","id":"打包类型文件","depth":3,"charIndex":2619},{"text":"别名转换","id":"别名转换","depth":3,"charIndex":3090},{"text":"一些示例","id":"一些示例","depth":3,"charIndex":3208},{"text":"构建过程","id":"构建过程","depth":2,"charIndex":3220},{"text":"构建报错","id":"构建报错","depth":2,"charIndex":3394},{"text":"调试模式","id":"调试模式","depth":2,"charIndex":3567}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":64,"title":"深入理解 dev 命令","content":"#\n\nModern.js Module 提供的 dev 命令主要用于代码的调试。\n\n\n命令运行的整体流程#\n\n 1. 当执行 dev 命令的时候,Modern.js Module 开始寻找是否存在可以执行的调试工具或者任务。调试工具或者任务就是类似 doc 这样的\n Modern.js Module 调试工具插件。\n 2. 当发现存在一个调试工具的时候,则会立即执行它。\n 3. 当发现多个调试工具的时候,则显示调试工具列表菜单。可以通过选择某个调试工具对应的名称选项启动它。\n 4. 当没有发现调试工具的时候,则告诉用户没有可用的调试工具。\n\n我们除了可以执行 dev 命令以外,也可以通过 dev [调试工具名称] 的方式来直接启动调试工具或者任务。\n\n\n扩展 dev 命令#\n\n如果需要扩展 dev 命令或者说提供自己的 Modern.js Module 调试工具插件,那么你需要先了解以下内容:\n\n * 开发插件\n * 调试工具插件 API\n\n一般来说,实现一个什么都不做的调试工具,其实现代码以及相关配置如下:\n\n\n\n如果需要使用该调试工具插件,则需要在配置文件中增加它:\n\n\n\n此时我们执行 dev 或者 dev do-nothing 命令的时候,就可以执行它了。在执行后,它会先执行监听模式的源码构建任务,并紧接着打印日志信息。\n\n对于目前官方支持的调试工具和第三方支持的调试工具,可以在插件列表中查看。","routePath":"/module-tools/guide/advance/in-depth-about-dev-command","lang":"zh","toc":[{"text":"命令运行的整体流程","id":"命令运行的整体流程","depth":2,"charIndex":42},{"text":"扩展 dev 命令","id":"扩展-dev-命令","depth":2,"charIndex":333}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":65,"title":"开始之前","content":"#\n\n\n环境准备#\n\n为了使用 Modern.js Module,首先需要 NodeJS,我们推荐最新的长期维护版本,并确保 Node 版本大于等于 16.0.0。因为非稳定的\nNodeJS 时常有一些 Bug,你可以使用 nvm-windows 和 nvm(Mac / Linux)安装,这样你就可以方便地切换到不同的 NodeJS\n版本,这些版本可能会用于不同的项目。\n\n\n初识 npm#\n\n当 NodeJS 被安装后,你不仅可以在命令行中访问 node 可执行程序,同时你也可以执行 npm 命令。\n\nnpm 是 NodeJS 的标准软件包管理器。它一开始的用途是用于下载和管理 NodeJS 包的依赖关系,但后来它逐渐变成为一个用于前端 JavaScript\n的工具。\n\n如果你已经对 npm 和 npm 包的使用方式有所了解,那么可以直接跳到「npm 包管理器」部分。\n\n\nnpm 包类型项目#\n\n那么什么是 npm 包类型的项目呢?当我们在一个空的项目目录下执行 npm init 命令的时候,它会在当前目录下面创建一个文件名为 package.json\n的 JSON 文件。在创建过程中,我们需要填写包括但不限于 npm 包的名称、版本号、描述等等内容,这些填写的内容都会在生成的 package.json\n文件中找到:\n\n\n\n此时这个包含了初始化后的 package.json 文件的项目就是一个 npm 包类型的项目,你可以执行 npm publish 命令将这个项目发布到 npm\nRegistry。\n\nnpm Registry 是一个 npm 包存储的地方,开发者们不仅可以将他们自己的 npm 包发布到 npm Registry,还可以通过 npm\nRegistry 使用其他开发者发布的 npm 包。\n\n优质的 npm 包会有更多的人去使用,因为它不仅节省了很多代码实现的工作,同时也不容易让项目出现问题。\n\n\n使用第三方 npm 包#\n\n当要为初始化的项目增加第三方的 npm 包的时候,我们可以把这一过程叫做“为项目安装依赖”或是“为项目增加依赖”。在增加依赖之前,首先我们要特别了解一件事情\n—— npm 依赖的软件包类型:\n\n * \"dependencies\":一种是你的应用程序在生产环境中需要的软件包。\n * \"devDependencies\":另一种是仅在本地开发和测试中需要的软件包。\n \n > 软件包可以理解为是第三方的 npm 包。\n\n你可以通过执行 npm install npm-package-name 或者 npm add npm-package-name\n的方式来安装在生产环境中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在 \"dependencies\"\n里,并执行 npm install 命令:\n\n\n\n同理,你也可以执行 npm install npm-package-name --save-dev 或 npm add npm-package-name\n--save-dev 的方式来安装仅在本地开发和测试中需要的软件包,或者也可以在 package.json 文件中手动的将需要安装的包和对应的语义化版本写在\n\"devDependencies\" 里,并执行 npm install 命令:\n\n\n\n在安装或者使用第三方 npm 包的时候一定要确定它们的用途,以及通过区分它们的类型确定好它们应该放在 \"dependencies\" 还是\n\"devDependencies\" 中。\n\nTIP\n\n一般来说,需要在源代码中使用到的包都属于 dependencies 依赖。除非你通过打包的方式将依赖的代码输出到本地,那么这种情况可以将它作为\ndevDependencies 依赖。\n\n\n还需要了解的 npm 零碎知识#\n\n\nnpm 包的程序入口#\n\n在 package.json 中存在一个 \"main\" 属性,它对应的值是一个模块 ID,或者更直观的说是一个 NodeJS 文件路径,它是你程序的主要入口。\n\n例如你的包名为 foo,并且用户安装了它,然后执行 require(\"foo\") 代码,那么 foo 这个 npm 包的 \"main\"\n字段对应的文件将会被导出。\n\n推荐在你的 npm 包里一定要设置 \"main\" 字段。如果没有设置 \"main\",则默认入口为包的根目录下的 index.js 文件。\n\n除了需要设置 \"main\" 属性以外,一般还会设置 \"module\" 属性。它与 \"main\" 属性的用途类似,它主要是用于在 webpack\n场景下使用。webpack 在大多数情况下,会以 \"module\" -> \"main\" 这个顺序读取 npm 包的入口(文件)。\n\n> 想要了解关于 webpack 如何做这件事,可以查看这个链接。\n\n\n\"scripts\"#\n\npackage.json 文件的 \"scripts\" 属性支持一些内置的脚本和 npm 预设的生命周期事件,以及任意的脚本。\n\n这些都可以通过运行 npm run-script 或简称 npm run 来执行。\n\n名称匹配的前置命令和后置命令也会被运行(例如 premyscript、myscript、postmyscript)。\n\n\n\n当执行 npm run myscripts 的时候,premyscripts 对应的脚本会在它之前执行,postmyscripts 对应的脚本会在它之后执行。\n\n来自依赖的脚本命令可以用 npm explore -- npm run 运行。\n\n还有一些特殊的生命周期脚本(Life Scripts),只在某些情况下发生。这里介绍几个通常需要了解的情况。\n\nnpm install#\n\n当你运行 npm install -g 时,以下脚本会运行。\n\n * preinstall\n * install\n * postinstall\n * prepublish\n * preprepare\n * prepare\n * postprepare\n\n如果你的软件包根目录有一个 binding.gyp 文件,而你没有定义 install 或 preinstall 脚本,那么 npm 将以 node-gyp\nrebuild 作为默认的 install 命令,使用 node-gyp 进行编译。\n\nnpm publish#\n\n当发布项目的时候,执行该命令会触发以下脚本:\n\n * prepublishOnly\n * prepack\n * prepare\n * postpack\n * publish\n * postpublish\n\n当以 --dry-run 模式运行的时候,prepare 对应的脚本将不会执行。\n\n\npeerDependencies#\n\n在某些情况下,你的 npm 项目与它的宿主工具或者库之间存在某种兼容关系(例如一个 webpack 插件项目和 webpack),同时你的 npm\n项目不想将宿主作为必要的依赖,这个时候通常说明你的项目可能是这个宿主工具或者库的插件。你的 npm\n项目会对宿主包的版本有一定的要求,因为只有在特定的版本下才会暴露出 npm 项目所需要的 API。\n\n关于更多 peerDependencies 的解释,可以通过下面的链接了解 npm、pnpm、Yarn 对于它的不同处理方式:\n\n * npm 对 peerDependencies 的解释\n * pnpm vs npm VS Yarn\n\n\nnpm 包管理器#\n\n除了 npm 这种标准的包管理器以外,目前主流的还有 pnpm 和 Yarn,它们都是不错的 npm cli 替代品。\n\n推荐使用 pnpm 来管理项目依赖,可以通过下面的方式安装它:\n\n\n\n\nModern.js Module 配置文件#\n\n通过 @modern-js/create 创建的项目目录下提供了 Modern.js Module 的配置文件 ——\nmodern.config.(j|t)s。但 modern.config 配置文件不是必须存在的。\n\n默认情况下,生成的配置文件的内容如下:\n\n\n\n我们推荐使用 defineConfig 函数,不过并不强制使用它。因此你也可以在配置文件中直接返回一个对象:\n\n","routePath":"/module-tools/guide/basic/before-getting-started","lang":"zh","toc":[{"text":"环境准备","id":"环境准备","depth":2,"charIndex":3},{"text":"初识 npm","id":"初识-npm","depth":2,"charIndex":188},{"text":"npm 包类型项目","id":"npm-包类型项目","depth":2,"charIndex":391},{"text":"使用第三方 npm 包","id":"使用第三方-npm-包","depth":2,"charIndex":818},{"text":"还需要了解的 npm 零碎知识","id":"还需要了解的-npm-零碎知识","depth":2,"charIndex":1602},{"text":"npm 包的程序入口","id":"npm-包的程序入口","depth":3,"charIndex":1621},{"text":"\"scripts\"","id":"scripts","depth":3,"charIndex":2042},{"text":"`npm install`","id":"npm-install","depth":4,"charIndex":-1},{"text":"`npm publish`","id":"npm-publish","depth":4,"charIndex":-1},{"text":"peerDependencies","id":"peerdependencies","depth":3,"charIndex":2825},{"text":"npm 包管理器","id":"npm-包管理器","depth":2,"charIndex":3139},{"text":"Modern.js Module 配置文件","id":"modernjs-module-配置文件","depth":2,"charIndex":3247}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":66,"title":"CLI 命令","content":"#\n\nModern.js Module 项目可以使用的 CLI 命令如下:\n\n\nmodern build#\n\n\n\nModern.js Module 支持 platform 构建模式,可以用于执行其他工具的构建任务,目前官方支持的有 Rspress。例如,可以通过执行\nmodern build --platform 命令启动 doc 构建任务生成 doc 产物。\n\n\nmodern new#\n\n\n\nmodern new 命令用于启动微生成器功能,它可以为项目启用默认没有提供的功能。\n\n目前可以开启的功能有:\n\n * Storybook V7\n * Tailwind CSS 支持\n * Modern.js Runtime API\n\n关于这些功能,可以通过「使用微生成器」 章节了解更多。\n\n\nmodern dev#\n\n\n\nModern.js Module 提供了使用调试工具的能力,可以通过 modern dev\n命令来启动。不过要注意的是,默认情况下是没有提供调试相关的插件,因此此时执行 modern dev 会提示: \"No dev tools found\navailable\"。\n\n目前官方支持的调试工具有 Rspress,因此在你执行 modern new 命令开启它后,就可以执行 modern dev 或者 modern dev doc\n执行它。\n\n\nmodern lint#\n\n\n\n运行 ESLint 检查代码语法情况。通常情况下,我们只需要在 git commit 阶段通过 lint-staged 检查本次提交修改的部分代码。\n\n * --no-fix 参数设置后可以关闭自动修复 lint 错误代码的能力。\n\n\nmodern change#\n\n\n\nmodern change 命令用于生成 changesets 需要的 Markdown 文件。\n\n\nmodern pre#\n\n\n\n可以使用 modern pre 命令在正式发布前预发布一个版本。\n\n\nmodern bump#\n\n\n\n按照 changesets 生成的变更记录的 Markdown 文件修改 package.json 中的版本号, 同时生成 CHANGELOG.md 文件。\n\n\nmodern release#\n\n\n\nmodern release 命令可以将模块发布到 npm Registry 上。\n\n * --tag 参数可以指定发布时具体的 dist tags。\n\n\nmodern gen-release-note#\n\n\n\n根据当前仓库的 changeset 信息自动生成 Release Note。\n\nTIP\n\n需要在 bump 命令之前执行。\n\n\nmodern upgrade#\n\n\n\nmodern upgrade 命令,用于升级项目 Modern.js 相关依赖至最新版本。\n\n在项目根目录下执行命令 npx modern upgrade,会默认将当前执行命令项目的 package.json 中的 Modern.js\n相关依赖更新至最新版本。","routePath":"/module-tools/guide/basic/command-preview","lang":"zh","toc":[{"text":"`modern build`","id":"modern-build","depth":2,"charIndex":-1},{"text":"`modern new`","id":"modern-new","depth":2,"charIndex":-1},{"text":"`modern dev`","id":"modern-dev","depth":2,"charIndex":-1},{"text":"`modern lint`","id":"modern-lint","depth":2,"charIndex":-1},{"text":"`modern change`","id":"modern-change","depth":2,"charIndex":-1},{"text":"`modern pre`","id":"modern-pre","depth":2,"charIndex":-1},{"text":"`modern bump`","id":"modern-bump","depth":2,"charIndex":-1},{"text":"`modern release`","id":"modern-release","depth":2,"charIndex":-1},{"text":"`modern gen-release-note`","id":"modern-gen-release-note","depth":2,"charIndex":-1},{"text":"`modern upgrade`","id":"modern-upgrade","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":67,"title":"修改输出产物","content":"#\n\n\n默认输出产物#\n\n当你在初始化的项目里使用 modern build 命令的时候,Modern.js Module 会根据当前配置内容,生成相应的构建产物。\n\n模板创建的默认配置内容如下:\n\n\n\n默认生成产物具有以下特点:\n\n * 会生成 CommonJS 和 ESM 两份产物。\n * 代码语法支持到 ES6 ,更高级的语法将会被转换。\n * 所有的代码经过打包变成了一个文件,即进行了 bundle 处理。\n * 产物输出根目录为项目下的 dist 目录,类型文件输出的目录为 dist/types。\n\n看到这里你可能会有以下疑问:\n\n 1. buildPreset 是什么?\n 2. 产物的这些特点是由什么决定的?\n\n接下来,我们首先来了解一下 buildPreset。\n\n\n构建预设#\n\nbuildPreset 代表着提前准备好的一组或者多组构建相关的配置,只需要使用 buildPreset\n对应的预设值,就可以省去麻烦且复杂的配置工作,得到符合预期的产物。\n\nModern.js Module 主要内置了两套构建预设,包括:\n\n * npm-component: 用于构建组件库。\n * npm-library: 用于打包其他库类型的项目,如工具库。\n\n同时,还提供一些变体,例如 npm-library-with-umd 和 npm-library-es5,顾名思义,分别对应带有 umd 产物和支持到 es5\n语法的库预设。 详细配置可以查看其 API 。\n\n除此之外,我们也可以完全自定义构建配置:\n\n\n构建配置#\n\nbuildConfig 是一个用来描述如何编译、生成构建产物的配置项。在最开始提到的关于“构建产物的特点”,其实都是 buildConfig\n所支持的属性。目前所支持的属性覆盖了大部分模块类型项目在构建产物时的需求,buildConfig\n不仅包含一些产物所具备的属性,也包含了构建产物所需要的一些特性功能。接下来从分类的角度简单罗列一下:\n\n构建产物的基本属性包括:\n\n * 产物是否被打包:对应的 API 是 buildConfig.buildType。\n * 产物对于语法的支持:对应的 API 是 buildConfig.target。\n * 产物格式:对应的 API 是 buildConfig.format。\n * 产物类型文件如何处理,对应的 API 是 buildConfig.dts。\n * 产物的 sourceMap 如何处理:对应的 API 是 buildConfig.sourceMap。\n * 产物对应的输入(或者是源文件):对应的 API 是 buildConfig.input。\n * 产物输出的目录:对应的 API 是 buildConfig.outDir。\n * 构建的源码目录:对应的 API 是 buildConfig.sourceDir。\n\n构建产物所需的常用功能包括:\n\n * 别名:对应的 API 是 buildConfig.alias。\n * 静态资源处理:对应的 API 是 buildConfig.asset。\n * 第三方依赖处理:对应的 API 有:\n * buildConfig.autoExternal。\n * buildConfig.externals。\n * 拷贝:对应的 API 是 buildConfig.copy。\n * 全局变量替换:对应的 API 是 buildConfig.define。\n * 指定 JSX 编译方式,对应的 API 是 buildConfig.jsx。\n\n一些高级属性或者使用频率不高的功能:\n\n * 产物代码压缩:对应的 API 是 buildConfig.minify。\n * 代码分割:buildConfig.spitting\n * 指定构建产物用于 NodeJS 环境还是浏览器环境:对应的 API 是 buildConfig.platform。\n * umd 产物相关:\n * 指定 umd 产物外部导入的全局变量:对应的 API 是 buildConfig.umdGlobals。\n * 指定 umd 产物的模块名:对应的 API 是 buildConfig.umdModuleName。\n\n除了以上分类以外,关于这些 API 的常见问题和最佳实践可以通过下面的链接来了解:\n\n * 关于 bundle 和 bundleless\n * 关于 input 和 sourceDir。\n * 关于类型描述文件。\n * 如何使用 define\n * 如何处理第三方依赖\n * 如何使用拷贝\n * 如何构建 umd 产物\n * 如何使用静态资源\n\n\n结合配置与预设#\n\n了解 buildPreset 和 buildConfig 之后,我们可以将二者进行结合使用。\n\n在实际项目中,我们可以先使用 buildPreset 来快速获取一套默认构建配置。如果需要自定义,可以使用 buildConfig 进行覆盖和扩展。\n\n扩展的逻辑如下:\n\n * 当 buildConfig 是数组时,会在原来的预设基础上添加新的配置项。\n\n\n\n这会在原本预设的基础上,额外生成一份 IIFE 格式、支持到 ES2020 语法的产物,输出目录为项目下的 dist/global 目录。\n\n * 当 buildConfig 是对象时,会将对象中的配置项覆盖到预设中。\n\n\n\n这会使得每一项构建任务都会生成 sourceMap 文件。","routePath":"/module-tools/guide/basic/modify-output-product","lang":"zh","toc":[{"text":"默认输出产物","id":"默认输出产物","depth":2,"charIndex":3},{"text":"构建预设","id":"构建预设","depth":2,"charIndex":344},{"text":"构建配置","id":"构建配置","depth":2,"charIndex":664},{"text":"结合配置与预设","id":"结合配置与预设","depth":2,"charIndex":1952}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":68,"title":"版本管理与发布","content":"#\n\n一个 npm 类型的模块项目发布流程包含了两个阶段:\n\n * 第一阶段是在开发期间,开发者需要提供变更文件,该文件记录了在发布期间需要的变更内容;\n * 第二阶段是在发布期间,需要收集所有的变更文件来更新版本、更新发布日志,并发布新的包到 npm Registry 上。\n\nModern.js Module 提供了一套版本管理与发布的方案,这适用于单包场景。对于 monorepo 里的 npm 包你需要遵循各类 monorepo\n解决方案提供的策略。\n\n\n跟踪变更#\n\n当项目发生变化的时候需要将变化的内容记录下来。项目发生的变化一般是指:\n\n * 新功能\n * 修复问题\n * 配置文件修改\n * ...\n\n当这些任务一旦开发完成后,需要通过以下命令来对当前的变化进行记录:\n\n * modern change\n\n执行 modern change 命令后会向开发者提出几个问题,并根据开发者的回答生成变更记录。变更记录文件包含了版本变化的类型和其描述,该文件会被提交到\ngit 仓库中。\n\n\n\n当执行成功后,生成的包含变更记录的 Markdown 文件会保存在项目的 .changeset 目录下面。其内容类似下面这样:\n\n\n\n\n版本更新#\n\n当需要更新项目版本的时候,执行以下命令:\n\n * modern bump\n\n执行 modern bump 将会基于 .changeset/ 目录下记录了变更的 Markdown 文件内容来修改 package.json\n中的版本号,同时生成 CHANGELOG.md 文件。而当版本更新完成后,这些记录变更的 Markdown 文件也会被删除,也可说这些 Markdown\n文件被“消耗”掉了。\n\n\n\n\n发布#\n\n发布项目可以执行以下命令:\n\n * modern release\n\nmodern release 命令可以将项目发布到 npm Registry。\n\n此时发布的是 latest 版本,也可以说是正式版本。如果想要修改 dist-tag,可以通过 modern release --tag 命令来指定。例如:\n\n\n\n但是如果希望将当前项目的版本号也修改为预发布的版本号,则需要使用 modern pre 命令。\n\n> 所谓 dist-tag,可以理解:为当前发布的版本打标签。一般来说,默认发布的版本对应的 dist-tag 为 latest,因此可以把 latest\n> 认为是正式版本的 dist-tag。\n\n\n预发布#\n\n当需要在正式发布之前进行预发布,则需要执行以下命令:\n\n * modern pre\n\n首先 modern pre enter 进入预发布模式, 可以与发布项目的时候使用 modern release --tag 命令指定的 tag 一致。\n\n\n\n接着可以使用 modern bump 命令更新具体的版本号,此时不会真正的“消耗”记录变更的 Markdown 文件:\n\n\n\n然后可以看到 package.json 中更新的版本号会类似这样:0.1.2-next.0。\n\n最后,如果不需要再进行预发布,则一定要执行 modern pre exit 命令,这样可以退出预发布状态,并且当再次执行 modern bump\n命令的时候,就可以发布正式的版本。","routePath":"/module-tools/guide/basic/publish-your-project","lang":"zh","toc":[{"text":"跟踪变更","id":"跟踪变更","depth":2,"charIndex":231},{"text":"版本更新","id":"版本更新","depth":2,"charIndex":519},{"text":"发布","id":"发布","depth":2,"charIndex":728},{"text":"预发布","id":"预发布","depth":2,"charIndex":1040}],"domain":"","frontmatter":{"sidebar_position":7},"version":""},{"id":69,"title":"使用微生成器","content":"#\n\nModern.js Module 提供了微生成器工具,它可以为当前项目:\n\n * 新增目录和文件\n * 修改 package.json\n * 执行命令\n\n因此通过这些能力,微生成器可以为项目开启额外的特性功能。\n\n可以通过 modern new 启动微生成器。目前 Modern.js Module 支持的微生成器功能有:\n\n\n开发模块文档#\n\n当我们想要为模块编写文档的时候,可以启用模块文档功能。会在项目目录下创建 docs 目录以及相关文件,在 package.json 中新增\n\"@modern-js/plugin-rspress\" 依赖。 使用 modern dev 和 modern build --platform\n来调试和构建你的文档站点。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n\n\n\nStorybook 调试#\n\n当我们想要对组件或者普通模块进行调试的时候,可以启用 Storybook 调试功能。启动该功能后,会在项目目录下创建 stories 目录以及\n.storybook 目录,在 package.json 中新增 \"@modern-js/storybook\" 依赖。使用 storybook dev 和\nstorybook build 来调试和构建。\n\n\nTailwind CSS 支持#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\n如果你想要在项目使用 Tailwind CSS,可以参考 「使用 Tailwind CSS」。\n\n\nModern.js Runtime API 支持#\n\nModern.js 提供了 Runtime API 能力,这些 API 只能在 Modern.js 的应用项目环境中使用。如果你需要开发一个 Modern.js\n应用环境中使用的组件,那么你可以开启该特性,微生成器会增加 \"@modern-js/runtime\"依赖。\n\n另外,Storybook 调试工具也会通过检测项目的依赖确定项目是否需要使用 Runtime API,并且提供与 Modern.js 应用项目一样的\nRuntime API 运行环境。\n\nTIP\n\n在成功开启后,会提示需要手动在配置中增加如下类似的代码。\n\n","routePath":"/module-tools/guide/basic/use-micro-generator","lang":"zh","toc":[{"text":"开发模块文档","id":"开发模块文档","depth":2,"charIndex":166},{"text":"Storybook 调试","id":"storybook-调试","depth":2,"charIndex":370},{"text":"Tailwind CSS 支持","id":"tailwind-css-支持","depth":2,"charIndex":561},{"text":"Modern.js Runtime API 支持","id":"modernjs-runtime-api-支持","depth":2,"charIndex":709}],"domain":"","frontmatter":{"sidebar_position":4},"version":""},{"id":70,"title":"开发模块文档","content":"#\n\n本章介绍如何为模块项目快速搭建一个静态文档站点。\n\n\n开始之前#\n\n\n为什么我们需要为模块搭建一个文档站点#\n\n 1. 文档站点可以帮助我们更好地组织文档的结构。\n 2. 文档站点具有更好的表现形式,例如可以在页面中执行函数,渲染组件等。\n 3. 可以更好地利用 AI 搜索的能力。\n\n\n前置准备#\n\n 1. 通过微生成器开启文档功能。\n 2. 阅读Rspress 介绍。\n\n完成准备工作之后,接下来我们会基于 Rspress 为模块项目搭建一个文档站点。\n\n\n站点基本结构#\n\n站点整体布局由三部分组成:导航栏、侧边栏以及正文部分,其中正文还包括了 TOC(Table of contents found at the beginning\nof a book or document)。\n\nRspress 使用的是文件系统路由,模块文档基于此实现了侧边栏的自动生成。 例如,如果你有以下的文件结构:\n\n\n\n那么 foo/bar.md 的路由路径会是 /foo/bar,foo.md 的路由路径会是 /foo,index.md 的路由路径会是 /。\n\n具体映射规则如下:\n\n文件路径 路由路径\nindex.md /\n/foo.md /foo\n/foo/index.md /foo/\n/foo/bar.md /foo/bar\n\n与上述文件路径和路由路径依次对应的侧边栏如下所示:\n\n\n配置侧边栏#\n\n如上图所示,模块文档已经为文件系统路由自动生成了侧边栏,其中侧边栏每一栏的文本是由文件的一级标题或者目录名决定。 如果你需要自定义侧边栏,请使用\n_meta.json 或者直接配置 sidebar。\n\nINFO\n\n如果你的文档目录结构是符合国际化的,例如:\n\n\n\n你需要按照国际化章节,同时配置 lang 和 locales,否则模块自动生成的侧边栏不会处理 zh 和 en 这两个目录。\n\n\n编写文档#\n\n接下来我们可以专注于文档内容的编写了。除了最基本的编写 markdown 以外,你可能还需要了解以下进阶内容:\n\n * 使用 MDX\n * 使用静态资源\n\n\n组件预览#\n\n模块文档为组件库提供了预览能力,jsx和tsx的代码块里的内容将会被解析为 React 组件。\n\n\n示例#\n\n假设我们的项目名是demo,并导出了一个 Button 组件。\n\n 1. 首先新增 docs/Button.mdx 文件:\n\n\n\n 2. 在tsconfig.json里配置别名,将包名指向当前项目目录,使得文档开发者和用户使用组件方式一致:\n\n\n\n 3. 在 .gitignore 文件下添加 doc_build/,文档产物将会生成在此目录下:\n\n\n\n恭喜你,已经完成了一个组件文档的编写,执行pnpm run dev看看效果吧,记得先构建一下组件库,确保组件产物存在。\n\n\n移动端预览#\n\n同时,我们也支持了移动端预览的方式,即使用 iframe 渲染移动端组件,并可以通过 iframePosition 设置 iframe\n的位置,支持扫码预览以及新页面打开。\n\n\n\nTIP\n\n如果只想要改变某一个 jsx 和 tsx 代码块的预览方式,可以使用不同的修饰符进行标识:\n\n\n\n\n使用外部 demo#\n\n如果我们的 demo 非常复杂,那么建议单独编写 demo,然后在 MDX 中使用 code 标签:\n\n\n\n这同样支持单独设置代码块的预览方式,例如:\n\n\n\n\n使用内置组件#\n\n插件内部实现了一部分内置组件,以便于你可以更轻松地开发模块文档。\n\n\nAPI#\n\n展示模块的 API 内容\n\n解析文件#\n\n在使用 API 组件之前,首先我们需要指定解析的文件:\n\n\n\n内容生成#\n\n接下来我们了解一下根据解析的文件会生成什么样的 markdown 内容。\n\n内容可以通过 react-docgen-typescript 或者 documentation 两个不同的工具生成:\n\n * react-docgen-typescript针对于组件库场景,仅会解析 props 生成表格。\n\n\n\n上面是一个标准写法,其中 ButtonProps 将被提取至表格中, Button 作为表格的标题。如果使用默认导出,文件名将作为表格标题。\n\n需要注意的是,export 导出事先定义的特性将不会被解析。\n\n\n\n生成的内容如下:\n\n\n\nWARNING\n\n如果 Props 里使用了 React 的类型,你需要在 tsconfig.json 里添加 types ,否则会解析不到 React 命名空间下的类型。\n\n\n\n更好的方式是直接引用类型,例如\n\n\n\n * documentation适用于工具库场景,用来解析 JSDoc 注释。\n\n\n\n上面是一个带有 JSDoc 注释的 greet 函数。生成的内容如下:\n\n\n\n组件使用#\n\n接下来,你便可以在文档里使用我们的内置 API 组件了,将key值传入moduleName属性里\n\n\n\n\nOverview#\n\n展示模块列表,可以放在首页用来展示所有模块。\n\nOverview 组件只有一个 list 属性,接收一个对象数组,下面是对象的属性\n\n属性 说明 类型 默认值\nicon 图标 React.ReactNode \ntext 文本(必填) string \nlink 链接(必填) string \narrow 是否展示箭头 boolean false\n\n\n插件配置#\n\n\napiParseTool#\n\nAPI 解析工具\n\n * 类型:'react-docgen-typescript' | 'documentation'\n * 默认值:'react-docgen-typescript'\n\n\ndoc#\n\n文档框架配置\n\n\nentries#\n\n自动生成文档的模块名称及相对路径\n\n * 类型:Entries | ToolEntries\n * 默认值:{}\n\n\n\nEntries 同时支持针对不同的文件使用不同的解析工具:\n\n\n\n\niframePosition#\n\niframe 所处页面位置\n\n * 类型:'follow' | 'fixed'\n * 默认值: 'follow'\n\nfollow时,每一个代码块都会有一个 iframe 展示其渲染视图。 fixed时,iframe 将会固定在页面右侧,展示当前页面所有代码块的视图。\n\n\nparseToolOptions#\n\nAPI 解析工具的参数\n\n * 类型:ParseToolOptions\n * 默认值:{}\n\n\n\n\npreviewMode#\n\n代码块预览方式。\n\n * 类型:'internal' | 'iframe'\n * 默认值: 'internal'\n\ninternal时,代码块内容将会直接渲染在页面中,反之将会通过 iframe 加载。\n\n\ndeprecated: languages#\n\nWARNING\n\n从 2.44.0 版本开始,请参考 国际化 章节来实现多语言。\n\n\ndeprecated: useModuleSidebar#\n\nWARNING\n\n从 2.44.0 版本开始,内部实现了嗅探机制,请直接使用 _meta.json 或者直接配置 sidebar 来实现自定义侧边栏。\n\n\n命令行#\n\n * modern dev: 启动文档站本地开发。\n * modern build --platform: 构建生产环境产物。\n\n\n进阶指南#\n\n以上已经介绍完了开发模块文档的基本内容,但是这对于开发一个完整的文档站是不够的。查看Rspress以深入了解我们的文档框架。 你可以通过 doc\n配置来修改文档框架配置。\n\n","routePath":"/module-tools/guide/basic/use-module-doc","lang":"zh","toc":[{"text":"开始之前","id":"开始之前","depth":2,"charIndex":29},{"text":"为什么我们需要为模块搭建一个文档站点","id":"为什么我们需要为模块搭建一个文档站点","depth":3,"charIndex":37},{"text":"前置准备","id":"前置准备","depth":3,"charIndex":146},{"text":"站点基本结构","id":"站点基本结构","depth":2,"charIndex":233},{"text":"配置侧边栏","id":"配置侧边栏","depth":3,"charIndex":625},{"text":"编写文档","id":"编写文档","depth":2,"charIndex":830},{"text":"组件预览","id":"组件预览","depth":2,"charIndex":916},{"text":"示例","id":"示例","depth":3,"charIndex":973},{"text":"移动端预览","id":"移动端预览","depth":3,"charIndex":1216},{"text":"使用外部 demo","id":"使用外部-demo","depth":3,"charIndex":1369},{"text":"使用内置组件","id":"使用内置组件","depth":2,"charIndex":1461},{"text":"API","id":"api","depth":3,"charIndex":1505},{"text":"解析文件","id":"解析文件","depth":4,"charIndex":1525},{"text":"内容生成","id":"内容生成","depth":4,"charIndex":1563},{"text":"组件使用","id":"组件使用","depth":4,"charIndex":2032},{"text":"Overview","id":"overview","depth":3,"charIndex":2092},{"text":"插件配置","id":"插件配置","depth":2,"charIndex":2360},{"text":"apiParseTool","id":"apiparsetool","depth":3,"charIndex":2368},{"text":"doc","id":"doc","depth":3,"charIndex":2478},{"text":"entries","id":"entries","depth":3,"charIndex":2493},{"text":"iframePosition","id":"iframeposition","depth":3,"charIndex":2596},{"text":"parseToolOptions","id":"parsetooloptions","depth":3,"charIndex":2749},{"text":"previewMode","id":"previewmode","depth":3,"charIndex":2818},{"text":"deprecated: languages","id":"deprecated-languages","depth":3,"charIndex":2936},{"text":"deprecated: useModuleSidebar","id":"deprecated-usemodulesidebar","depth":3,"charIndex":3003},{"text":"命令行","id":"命令行","depth":2,"charIndex":3112},{"text":"进阶指南","id":"进阶指南","depth":2,"charIndex":3184}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":71,"title":"使用 Storybook","content":"#\n\nStorybook 是一个专门用于组件调试的工具,它围绕着组件开发提供了:\n\n * 丰富多样的调试能力\n * 可与一些测试工具结合使用\n * 可重复使用的文档内容\n * 可分享能力\n * 工作流程自动化\n\n在使用 Storybook 时,难免会遇到各种配置问题,需要手动配置 Babel 插件,手动配置 Webpack 去支持 less,sass 等。\nModern.js 集成了 Storybook,这对于我们开发 Storybook 项目来说极大地简化了配置工作。\n\n\nV7 (推荐)#\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建配置文件夹 .storybook,以及默认配置文件 .storybook/main.ts\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @storybook/addon-essential 和 @modern-js/storybook,以及创建\n storybook 相关脚本。\n\n\n开启产物调试#\n\n事实上,Modern.js Module 是基于 esbuild 实现的,而 Storybook 使用 Webpack\n作为默认构建工具,二者的配置无法完全兼容, 所以这里我们推荐先对组件进行构建,然后在 stories 里引入组件产物。\n\n引入组件产物的方式非常简单,假设你的模块导出了一个 Button 组件,那么在 stories 里可以这样使用:\n\n\n\n如果想要更新组件,则可以在启动 Storybook 前启动监听模式的构建:\n\n\n\nINFO\n\n在开发过程中,可能会遇到无法实时获得类型定义的情况。因为只有当保存代码后,产物目录下的类型文件才会更新。此时:\n\n对于 pnpm 的项目,可以按照下面的内容对 package.json 进行修改:\n\n\n\n> 关于 pnpm 的 publishConfig 的使用,可以阅读下面这个链接。\n\n而对于 npm 和 Yarn 的项目,则只能通过手动的方式在开发阶段和发布阶段对 package.json 的 types 的值进行修改。\n\n\n开启 Rspack 构建#\n\nRspack 构建速度非常快,只需要如下配置即可使用 Rspack 作为构建工具。\n\n\n\n注意上面配置中,更改了 reactDocgen 配置,因为 Rspack 目前还不支持\n@storybook/react-docgen-typescript-plugin。\n\n\n配置#\n\n在 .storybook/main.js 中包含一些独有的配置。\n\nbundler#\n\n * 类型: 'webpack' | 'rspack'\n * 默认值: webpack\n\n指定底层打包工具使用 Webpack 还是 Rspack。\n\n\n\nbuilderConfig#\n\n * 类型: BuilderConfig\n * 默认值: undefined\n\nModern.js 的 Storybook 构建能力由 Rsbuild 提供,可通过 builderConfig 修改 Rsbuild 构建配置。\n\n\n\n\n命令行#\n\n@modern-js/storybook 代理了部分 storybook cli 的命令。\n\nstorybook dev#\n\n启动 Storybook,查看详情\n\nstorybook build#\n\n对 Storybook 进行生产环境构建,查看详情\n\n\n配置文件#\n\n配置文件中除了 Rsbuild 配置还包含一个额外的字段,builderPlugins,方便使用 Rsbuild 插件,例如启用 SWC 编译。\n\n\n\n\n从 V6 迁移至 V7#\n\n我们对于两个版本的支持方式不同,因此如果你是从 V6 迁移至 V7 的用户,我们希望你也按上述方式使用 V7,同时做以下调整:\n\n * 配置文件:将原来 root/config/storybook/main.(j|t)s 里的自定义配置(如果有)迁移到新的\n root/.storybook/main.(j|t)s。\n * 依赖:升级 @storybook/addon-* 系列依赖(如果有)到 7 版本,并删除 @modern-js/plugin-storybook 依赖。\n * 命令: 将原来 edenx dev storybook 和 edenx build --platform 命令删除,如果习惯了原来的 pnpm run\n dev 的调用方式,可以 将其替换成 storybook dev -p 6006 和 storybook build。\n * modern.config.(j|t)s : 删除 @modern-js/plugin-storybook 插件的注册。\n\n\nV6 (legacy)#\n\n从 2.40.0 版本开始,@modern-js/plugin-storybook将停止迭代。建议使用 V7 版本。 如果你的\n@modern-js/module-tools 版本低于 2.40.0,可以按照以下方式使用 Storybook V6:\n\n\n开启 Storybook#\n\n可以直接使用如下命令开启 Storybook 功能。\n\n\n\n该命令会创建好 Storybook 常用的模版,包括\n\n * 创建 stories 组件示例\n * 更新 package.json,新增依赖 @modern-js/plugin-storybook,以及添加 pnpm dev storybook\n 等相关脚本。\n\n\n配置 Storybook#\n\nStorybook 官方通过一个名为 .storybook 的文件夹来进行项目配置,其中包含各种配置文件。在 Modern.js Module 中,可以在项目的\nconfig/storybook 目录下增加 Storybook 配置文件。\n\n关于 Storybook 各种配置文件的使用方式,可以查看下面的链接:\n\n * Configure Storybook\n\n不过这在模块项目里使用时存在一些限制:\n\n * 不能修改 Story 文件存放的位置,即无法在 main.js 文件里修改 stories 配置。\n * 不能修改 Webpack 和 Babel 相关的配置,即无法在 main.js 文件里修改 webpackFinal 和 babel 配置。\n\n\n构建 Storybook 产物#\n\n除了可以对组件或者普通的模块进行 Storybook 调试,还可以通过下面的命令来执行 Storybook 的构建任务。\n\n\n\n构建完成后,可以在 dist/storybook-static 目录看到构建产物文件。","routePath":"/module-tools/guide/basic/using-storybook","lang":"zh","toc":[{"text":"V7 (推荐)","id":"v7-推荐","depth":2,"charIndex":239},{"text":"开启 Storybook","id":"开启-storybook","depth":3,"charIndex":250},{"text":"开启产物调试","id":"开启产物调试","depth":3,"charIndex":492},{"text":"开启 Rspack 构建","id":"开启-rspack-构建","depth":3,"charIndex":946},{"text":"配置","id":"配置","depth":3,"charIndex":1095},{"text":"bundler","id":"bundler","depth":4,"charIndex":1134},{"text":"builderConfig","id":"builderconfig","depth":4,"charIndex":1222},{"text":"命令行","id":"命令行","depth":3,"charIndex":1356},{"text":"storybook dev","id":"storybook-dev","depth":4,"charIndex":1409},{"text":"storybook build","id":"storybook-build","depth":4,"charIndex":1444},{"text":"配置文件","id":"配置文件","depth":3,"charIndex":1490},{"text":"从 V6 迁移至 V7","id":"从-v6-迁移至-v7","depth":2,"charIndex":1574},{"text":"V6 (legacy)","id":"v6-legacy","depth":2,"charIndex":2037},{"text":"开启 Storybook","id":"开启-storybook-1","depth":3,"charIndex":2178},{"text":"配置 Storybook","id":"配置-storybook","depth":3,"charIndex":2358},{"text":"构建 Storybook 产物","id":"构建-storybook-产物","depth":3,"charIndex":2705}],"domain":"","frontmatter":{"sidebar_position":5},"version":""},{"id":72,"title":"开发组件","content":"#\n\n本章将要介绍如何使用 Modern.js Module 开发组件项目。\n\n\n初始化项目#\n\n 1. 推荐使用 @modern-js/create 命令来初始化一个 npm 项目。\n\n\n\n 2. 初始化的目录结构如下:\n\n\n\n 3. 最后修改 ./src/index.ts 文件后缀和内容如下,就完成了组件项目的初始化。\n\n\n\n\n使用 Storybook 调试代码#\n\n请参考 「使用 Storybook」 来使用 Storybook 调试代码。\n\n\n开发样式#\n\n接下来我们可以给组件添加样式。\n\n目前支持开发样式的能力有:\n\n * CSS/PostCSS\n * Less\n * Scss/Sass\n * Tailwind CSS\n * CSS Modules\n\n\nCSS/PostCSS#\n\nModern.js Module 支持 PostCSS,并且内置了以下 PostCSS 插件:\n\n * flexbugs-fixes\n * custom-properties\n * initial\n * page-break\n * font-variant\n * media-minmax\n * nesting\n\n因此我们可以在项目中创建 .css 文件,并且可以直接在 css 文件中使用这些插件提供的语法支持和能力。\n\n * 源代码:\n\n\n\n * CSS 产物:\n\n\n\n\nLess#\n\nModern.js Module 支持使用 Less 开发样式。\n\n> 目前内置的 Less 版本为 v4.1.3\n\n * 源代码:\n\n\n\n * Less 产物:\n\n\n\n\nSass/Scss#\n\nModern.js Module 支持使用 Scss/Sass 开发样式。\n\n> 目前内置的 Sass 版本为 v1.54.4\n\n * 源代码:\n\n\n\n * Sass 产物:\n\n\n\n\nTailwind CSS#\n\n请参考 「使用 Tailwind CSS」 来了解相关用法。\n\n\nCSS Modules#\n\nModern.js Module 支持使用 CSS Module 开发样式。默认情况下会将以下文件识别为 CSS Module 文件:\n\n * .module.css\n * .module.less\n * .module.scss\n * .module.sass\n\n如果需要对 CSS Modules 进行配置,可以查看以下 API:\n\n * style.autoModules\n * style.modules\n\n下面是一个代码示例:\n\n\n\n\n\n\n配置构建产物#\n\n根据组件项目使用的多数场景,推荐使用 npm-component 构建预设。该预设得到的产物目录结构为:\n\n\n\n * ./dist/es: 包含了支持 es6 语法的 ES modules 格式的 bundleless 产物。\n * ./dist/lib: 包含了支持 es6 语法的 CommonJS 格式的 bundleless 产物。\n * ./dist/types: 包含了类型文件。\n\n如果对使用语法支持有要求,可以手动配置 buildPreset,并且支持在 npm-component 基础上增加后缀的方式修改支持的语法:\n\n\n\n如果对构建产物目录结构有特殊需求,则可以使用 buildConfig API,可以通过以下文档来了解使用方式:\n\n * 修改输出产物\n * 深入理解构建\n\n\n发布组件#\n\n推荐使用 Modern.js Module 提供的版本发布功能,可以参考 「版本管理与发布」。","routePath":"/module-tools/guide/best-practices/components","lang":"zh","toc":[{"text":"初始化项目","id":"初始化项目","depth":2,"charIndex":40},{"text":"使用 Storybook 调试代码","id":"使用-storybook-调试代码","depth":2,"charIndex":166},{"text":"开发样式","id":"开发样式","depth":2,"charIndex":227},{"text":"CSS/PostCSS","id":"csspostcss","depth":3,"charIndex":335},{"text":"Less","id":"less","depth":3,"charIndex":587},{"text":"Sass/Scss","id":"sassscss","depth":3,"charIndex":680},{"text":"Tailwind CSS","id":"tailwind-css","depth":3,"charIndex":784},{"text":"CSS Modules","id":"css-modules","depth":3,"charIndex":832},{"text":"配置构建产物","id":"配置构建产物","depth":2,"charIndex":1071},{"text":"发布组件","id":"发布组件","depth":2,"charIndex":1431}],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":73,"title":"使用 Tailwind CSS","content":"#\n\nTailwind CSS 是一个以 Utility Class 为基础的 CSS 框架和设计系统,可以快速地为组件添加常用样式,同时支持主题样式的灵活扩展。\n\nModern.js Module 支持使用 Tailwind CSS 开发组件样式。\n\n\n启用 Tailwind CSS#\n\n在 Modern.js Module 中使用 Tailwind CSS,你只需要按照以下步骤操作:\n\n 1. 在项目根目录下执行 pnpm run new,按照如下进行选择:\n\n\n\n成功开启后,你会看到 package.json 中新增了 tailwindcss 和 @modern-js/plugin-tailwindcss 依赖。\n\n 2. 在 modern.config.ts 中注册 Tailwind 插件:\n\n\n\n 3. 创建 index.css 文件,添加以下代码:\n\n\n\nINFO\n\n根据需求不同,你可以选择性地导入 Tailwind CSS 提供的 CSS 样式。请参考 @tailwind 文档 来了解 @tailwind 指令的详细用法。\n\n 4. 引用 index.css 文件,比如在入口的 src/index.jsx 文件添加如下代码:\n\n\n\n 5. 然后即可在各个组件中使用 Tailwind CSS 提供的 Utility Class 了:\n\n\n\n\n配置 Tailwind CSS#\n\n在 Modern.js Module 中,你有两种方式来配置 Tailwind CSS:\n\n 1. 使用 tailwind.config.{ts,js} 文件,该用法与 Tailwind CSS 的官方用法一致,请参考 \"Tailwind CSS -\n Configuration\" 来了解更多用法。\n\n\n\nTIP\n\n请升级 Modern.js Module 到 >= 2.33.0 版本,以支持自动读取 tailwind.config.{ts,js} 文件。\n\n 2. 使用 style.tailwindcss 配置项,这是旧版本的用法,我们更推荐使用 tailwind.config.{ts,js} 文件进行配置。\n\n\n\n如果你同时使用了 tailwind.config.{ts,js} 文件和 style.tailwindcss 选项,那么 style.tailwindcss\n定义的配置会优先生效,并覆盖 tailwind.config.{ts,js} 中定义的内容。\n\n\nTailwind CSS 自动补全#\n\nTailwind CSS 官方提供了 Tailwind CSS IntelliSense 插件,用于在 VS Code 中自动补全 Tailwind CSS 的\nclass names、CSS functions 和 directives。\n\n你可以参考以下步骤来启动自动补全功能:\n\n 1. 在 VS Code 中安装 Tailwind CSS IntelliSense 插件。\n 2. 如果项目的根目录没有 tailwind.config.{ts,js} 文件,那么你需要创建该文件,并写入当前项目的 Tailwind CSS 配置,否则\n IDE 插件将无法正确生效。\n\n\n构建模式#\n\n在使用 Tailwind CSS 时,请注意构建产物在 bundle 和 bundleless 两种模式下会有很大区别。\n\nTIP\n\n关于 bundle 和 bundleless 的定义,可以查看 「深入理解构建」\n\n\nBundle 模式#\n\n在 Bundle 模式下,会生成一份单独的产物 CSS 文件,并且 JS 产物不会自动引用产物 CSS 文件。\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n\n如果你需要将样式注入 JS 产物中,可以开启 style.inject 选项。\n\n如果你没有开启 style.inject,那么也可以让用户手动引用产物 CSS 文件:\n\n\n\n\nBundleless 模式#\n\n在 Bundleless 模式下,默认会引用产物 CSS 文件,无须进行额外处理。\n\n * 产物代码:\n\n\n\n\n类名前缀#\n\n你可以通过 Tailwind CSS 提供的 prefix 选项来添加类名前缀,这样可以避免潜在的类名冲突问题(比如 App 和 Module 使用了不同版本的\nTailwind CSS)。\n\n例如,通过 prefix 选项添加 foo- 前缀:\n\n\n\n * 源代码:\n\n\n\n * 产物代码:\n\n\n\n\n用法介绍#\n\n下面是一些 Tailwind CSS 的用法示例。\n\n\nHTML 类名#\n\nTailwind CSS 支持在 HTML 标签上通过类名的方式增加样式。当使用 HTML 类名的时候,请注意必须要提前导入 Tailwind CSS 相应的\nCSS 样式。\n\n\n\n样式产物(此时是 bundle 构建):\n\n\n\n\n@apply#\n\nTailwind CSS 提供了 @apply 指令,可以通过它将 Tailwind CSS 提供的样式内联到我们编写的样式中。\n\n@apply 可以用于 CSS、Less、Sass 中。\n\n\n\n但是使用过程中,对于 Less 和 Sass 有些情况需要注意:\n\nSass#\n\n当将 Tailwind 与 Sass 一起使用时,@apply 后面存在 !important 的时候,需要使用插值来让 Sass 正确编译。\n\n * 不能正常工作:\n\n\n\n * 能够正常工作:\n\n\n\nLess#\n\n在与 Less 一起使用 Tailwind 时,你不能嵌套 Tailwind 的 @screen 指令。\n\n * 不能正常工作:\n\n\n\n * 相反,使用常规的媒体查询和 theme() 函数来引用你的屏幕尺寸,或者干脆不要嵌套你的 @screen 指令。\n\n\n\n\n\n\n关于 designSystem 配置#\n\ndesignSystem 是 Modern.js Module 中废弃的配置项。\n\n从 Modern.js Module v2.33.0 版本开始,你可以使用 Tailwind CSS 的 theme 配置项来代替\ndesignSystem,不再需要将 theme 配置拆分并设置到 designSystem 上。\n\n * 旧版本用法:\n\n\n\n * 当前版本用法:\n\n","routePath":"/module-tools/guide/best-practices/use-tailwindcss","lang":"zh","toc":[{"text":"启用 Tailwind CSS","id":"启用-tailwind-css","depth":2,"charIndex":127},{"text":"配置 Tailwind CSS","id":"配置-tailwind-css","depth":2,"charIndex":585},{"text":"Tailwind CSS 自动补全","id":"tailwind-css-自动补全","depth":2,"charIndex":1047},{"text":"构建模式","id":"构建模式","depth":2,"charIndex":1360},{"text":"Bundle 模式","id":"bundle-模式","depth":3,"charIndex":1477},{"text":"Bundleless 模式","id":"bundleless-模式","depth":3,"charIndex":1660},{"text":"类名前缀","id":"类名前缀","depth":2,"charIndex":1732},{"text":"用法介绍","id":"用法介绍","depth":2,"charIndex":1890},{"text":"HTML 类名","id":"html-类名","depth":3,"charIndex":1925},{"text":"`@apply`","id":"apply","depth":3,"charIndex":-1},{"text":"Sass","id":"sass","depth":4,"charIndex":2192},{"text":"Less","id":"less","depth":4,"charIndex":2300},{"text":"关于 `designSystem` 配置","id":"关于-designsystem-配置","depth":2,"charIndex":-1}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":74,"title":"通用类问题","content":"#\n\n\nModern.js Module 和 Rsbuild 的关系?#\n\nModern.js Module 使用 esbuild 构建工具库和组件库,Rsbuild 专注于解决 Web 应用构建场景。\n\n\nModern.js Module 是否可以使用 webpack plugin 或者 loader?#\n\nModern.js Module 基于 esbuild 构建,无法使用 webpack 相关生态的工具。 这里可以发现更多 esbuild 社区插件\n\n如果 Modern.js Module 生产的 UMD 产物达不到你的要求,可以使用 Rsbuild 并添加 UMD Plugin 构建 UMD 产物。","routePath":"/module-tools/guide/faq/basic","lang":"zh","toc":[{"text":"Modern.js Module 和 Rsbuild 的关系?","id":"modernjs-module-和-rsbuild-的关系","depth":2,"charIndex":3},{"text":"Modern.js Module 是否可以使用 webpack plugin 或者 loader?","id":"modernjs-module-是否可以使用-webpack-plugin-或者-loader","depth":2,"charIndex":103}],"domain":"","frontmatter":{},"version":""},{"id":75,"title":"构建相关问题","content":"#\n\n这里只记录了一些常见问题和 bad case。\n\n如果是构建产物不符合预期的场景,尤其是配置了 buildPreset 的情况下, 请先了解 buildPreset 代表了哪些配置项,再根据所有的配置项逐个检查\n\n\n产物问题#\n\n\nClass Fields 的初始化处理#\n\nTypeSript 提供了 useDefineForClassFields 配置用于控制对于 public class fields 的转换处理。\n\n如果有一段代码:\n\n\n\n当 useDefineForClassFields 为 false 的时候,则编译后的代码会变为:\n\n\n\n当 useDefineForClassFields 为 true 的时候,则编译后的代码会变为:\n\n\n\n同时该配置的默认值会根据 tsconfig.json 的 target 配置而变化:当 target 是 ES2022 或者更高的时候,则\nuseDefineForClassFields 默认配置为 true,否则就是默认为 false。\n\n关于 TypeScript 这个配置的更多信息,可以参考下面的链接:\n\n * The useDefineForClassFields Flag and The declare Property Modifier\n\nModern.js Module 目前会根据下面的逻辑进行处理:\n\n 1. 首先根据当前项目的 tsconfig.json 的 useDefineForClassFields 配置确定在 Modern.js Module\n 内部如何处理。目前只会读取当前项目路径下的 tsconfig.json 文件的内容,暂时不支持根据 extends 配置来获取最终的 tsconfig\n 配置。\n 2. 如果没有检测 tsconfig.json 的 useDefineForClassFields 配置,则会根据 tsconfig.json 的\n target 配置来确定默认值。如果 target 大于 ES2022(包含 EsNext),则useDefineForClassFields默认为\n true,否则为 false。\n 3. 如果没有检测到 tsconfig.json 的 target,则按照 useDefineForClassFields的值 为 true 进行处理。\n\n\nbabel-plugin-lodash 将引入的 lodash 处理成 undefined#\n\n当使用类似下面的方式的时候,会出现这个问题:\n\n\n\n目前在 babel-plugin-lodash Github 上的相关 Issue:\n\n * #235\n\n这个问题的解决办法是移除 babel-plugin-lodash,因为此时不需要该插件进行按需引用,使用该插件会产生副作用。\n\n类似的情况在 babel-plugin-import 上也可能会出现。比如有类似如下的代码:\n\n\n\n此时 babel-plugin-import 也可能会导致 Comps 变为 undefined。因此也需要移除对应的 babel-plugin-import。\n\n\nCannot find module 'http'#\n\n如果产物在浏览器运行时报了类似 Cannot find module 'http' 的错误,说明你的产物打包进了 node 模块。\n这可能会发生于你的依赖里有一些同时支持 browser 和 node 的三方包,例如 axios,此时只需要将 platform 设置为 browser 即可。\n如果一些三方包不支持 browser, 你可能需要手动注入 node polyfill。\n\n\n异常类问题#\n\n\nDynamic require of \"react\" is not supported#\n\n问题描述#\n\n当构建的产物配置中产物格式为 ES modules 的时候:\n\n\n\n如果导入了的第三方 npm 包的 cjs 产物,那么生成的产物可能会在 webpack 下有可能无法正常运行。\n\n\n\n解决办法#\n\n 1. 首先需要找到是哪个第三方包引起的问题。例如报错信息中指向了 react 这个包,那么就要寻找在哪个第三方包里存在 require('react')\n 这样的代码。比如 react-draggable ,这个包仅包含 cjs 产物,那么问题定位到 react-draggable 这个包。\n 2. 然后我们需要将这个包通过下面的配置进行排除,即不打包存在问题的第三方包。\n\n\n\n参考链接#\n\n * When using esbuild with external react I get Dynamic require of \"react\" is\n not supported\n\n\n编译过程中,因为某个组件库的 less 文件报错:'Operation on an invalid type'#\n\n可能是因为该组件库依赖的 Less 版本是 v3,而 Modern.js Module 默认是 v4。v3 与 v4 在 math 配置上存在有 Break\nChange,可以查看这个链接 了解详情。\n\n因此,如果是在源码中使用了类似这样的组件库:\n\n在构建配置中使用了 buildPreset 的情况下,按照下面进行修改:\n\n\n\n或者使用了自定义的 buildConfig 的情况下,按照下面进行修改:\n\n\n\n如果是在 Storybook 中使用了类似这样的组件,则需要修改 Storybook 的调试配置:\n\n\n\n\nBundleless DTS failed#\n\n在不打包的场景下,是直接 tsc\n生成类型声明文件。通过终端打印的错误信息,你可以找到问题文件。对于源码文件,推荐将类型问题进行修复,这能够更好地使你的包得到复用。但如果遇到三方包的类型检查问题\n:\n\n 1. 开启 skipLibCheck 来跳过三方包的 d.ts 检查。\n 2. 如果三方包直接导出 ts 文件, skipLibCheck 将会失效,因为其只能跳过 d.ts 检查,因此你只能关闭 dts.abortOnError\n 来忽略这些错误。\n\n\nBundle DTS failed#\n\nModern.js Module 直接使用 rollup-plugin-dts 来打包你的类型描述文件。 它可能无法处理某些第三方依赖的类型文件。\n\n如果遇到 Modern.js Module 构建过程中出现 Bundle DTS failed\n的错误信息标题的时候,可以观察报错信息是来自某个第三方依赖。尝试设置 dts.respectExternal 为 false\n来关闭打包第三方依赖的类型文件的行为。\n\n\ndefineConfig 函数类型报错:如果没有引用 \"...\",则无法命名 \"default\" 的推断类型#\n\n检查项目的 tsconfig.json 文件中是否存在 include 配置,如果没有,则尝试增加下面的内容:\n\n\n\n\n其他#\n\n\nbundleless 如何跳过对 less / scss 文件的预处理#\n\nbundleless 是单文件编译的方式,只需要将你的 less / scss 文件从入口里移除并且将其拷贝到产物里即可。 注意我们还会把 js 引用 less\n/ scss 的 moduleId 进行改写,你可以通过 redirect 配置关闭它。\n\n下面是一个跳过 less 文件处理的例子,你会发现 src 里面所有的 less 文件都被拷贝到 dist 里并且保留了一致的相对路径。\n\n\n\n\n增加额外的编译能力#\n\nModern.js Module 基于 esbuild 实现,因此如果有特殊需求或者想要增加额外的编译能力,可以通过实现 esbuild 插件来解决。\n\nModern.js Module 提供了 esbuildOptions 配置允许修改 Modern.js Module 内部的 esbuild\n配置,因此可以通过该配置来增加自定义的 esbuild 插件:\n\n\n\n在增加 esbuild 插件时,请注意你需要将插件加在 plugins 数组的头部,因为 Modern.js Module 内部也是通过一个 esbuild\n插件介入到整个构建流程中去的,因此需要将自定义插件优先注册。\n\n\n支持生成 CSS Modules 的 TypeScript 声明文件#\n\n * 方案一:typed-css-modules\n * 方案二:postcss-modules-dts\n\n","routePath":"/module-tools/guide/faq/build","lang":"zh","toc":[{"text":"产物问题","id":"产物问题","depth":2,"charIndex":110},{"text":"Class Fields 的初始化处理","id":"class-fields-的初始化处理","depth":3,"charIndex":118},{"text":"babel-plugin-lodash 将引入的 lodash 处理成 `undefined`","id":"babel-plugin-lodash-将引入的-lodash-处理成-undefined","depth":3,"charIndex":-1},{"text":"Cannot find module 'http'","id":"cannot-find-module-http","depth":3,"charIndex":1337},{"text":"异常类问题","id":"异常类问题","depth":2,"charIndex":1559},{"text":"Dynamic require of \"react\" is not supported","id":"dynamic-require-of-react-is-not-supported","depth":3,"charIndex":1568},{"text":"问题描述","id":"问题描述","depth":4,"charIndex":1614},{"text":"解决办法","id":"解决办法","depth":4,"charIndex":1714},{"text":"参考链接","id":"参考链接","depth":4,"charIndex":1916},{"text":"编译过程中,因为某个组件库的 less 文件报错:`'Operation on an invalid type'`","id":"编译过程中因为某个组件库的-less-文件报错operation-on-an-invalid-type","depth":3,"charIndex":-1},{"text":"Bundleless DTS failed","id":"bundleless-dts-failed","depth":3,"charIndex":2338},{"text":"Bundle DTS failed","id":"bundle-dts-failed","depth":3,"charIndex":2595},{"text":"`defineConfig` 函数类型报错:`如果没有引用 \"...\",则无法命名 \"default\" 的推断类型`","id":"defineconfig-函数类型报错如果没有引用-则无法命名-default-的推断类型","depth":3,"charIndex":-1},{"text":"其他","id":"其他","depth":2,"charIndex":2940},{"text":"bundleless 如何跳过对 less / scss 文件的预处理","id":"bundleless-如何跳过对-less--scss-文件的预处理","depth":3,"charIndex":2946},{"text":"增加额外的编译能力","id":"增加额外的编译能力","depth":3,"charIndex":3184},{"text":"支持生成 CSS Modules 的 TypeScript 声明文件","id":"支持生成-css-modules-的-typescript-声明文件","depth":3,"charIndex":3492}],"domain":"","frontmatter":{},"version":""},{"id":76,"title":"常见问题","content":"#\n\n这里是 Modern.js Module 常见问题分类列表:\n\n * 通用类问题\n * 构建相关问题\n * Storybook 相关问题","routePath":"/module-tools/guide/faq/","lang":"zh","toc":[],"domain":"","frontmatter":{},"version":""},{"id":77,"title":"Storybook 相关问题","content":"#\n\n\n支持 Storybook v7#\n\nStorybook v7 目前已全面支持并已成为我们的推荐使用版本。\n\n\n使用 Storybook Addon 或者其他配置不生效#\n\nModern.js Module 目前使用的 Storybook 版本是 v6,如果使用了 v7 版本的 Addon 可能会出现插件不生效的情况。\n\n除了 Addon 以外,其他配置也可能会有区别。比如修改 preview.js 配置文件的话,Storybook v6 与 v7 的写法也不相同:\n\n * v6:文档链接\n * v7:文档链接\n\n\nCannot find module 'react-dom/package.json'#\n\n在执行 Storybook 调试的时候,出现下面的报错提示:\n\n\n\n解决办法:在项目中安装 react-dom 依赖。\n\n\n\n\n报错后,看不到具体报错信息#\n\n解决办法:\n\n 1. 找到 @storybook/core-server/dist/cjs/dev-server.js\n 2. 找到 var _await$Promise$all = await Promise.all([preview, manager 这附近的代码。\n 3. 修改成:\n\n\n\n\nCouldn't find any stories is your Storybook#\n\n\n\n当在预览区域看到类似这样的报错提示的时候,首先可以打开一下浏览器的控制台,应该会有些报错信息。可以先根据报错信息来推断是不是编写代码里出现的问题导致\nStorybook 无法正常运行。修复后,再次刷新查看是否正常。\n\n\nStorybook 添加 Proxy 功能#\n\nStorybook 没有提供相关方案,不过 Storybook Issue 中有找到相关的解决办法。在 Modern.js Module 中,你可以:\n\n 1. 添加 .storybook/middleware.js 文件,并初始化下面的内容:\n\n\n\n 2. 添加 http-proxy-middleware 依赖\n 3. 添加代理路由相关配置\n\n\n\n相关 issue 链接:#11551。\n\n\nTailwind CSS 在 Storybook 中不生效#\n\nModern.js Module 的 Storybook 构建能力由 Rsbuild 提供,由于 Rsbuild 的底层实现与 Modern.js Module\n并未打通,因此, Modern.js Module 插件无法在 Storybook (Rsbuild) 中生效。\n\n解决办法:需要在 storybook 中单独注册 tailwindcss 的 PostCSS 插件。\n\n参考链接:Rsbuild - tailwindcss。","routePath":"/module-tools/guide/faq/storybook","lang":"zh","toc":[{"text":"支持 Storybook v7","id":"支持-storybook-v7","depth":2,"charIndex":3},{"text":"使用 Storybook Addon 或者其他配置不生效","id":"使用-storybook-addon-或者其他配置不生效","depth":2,"charIndex":58},{"text":"Cannot find module 'react-dom/package.json'","id":"cannot-find-module-react-dompackagejson","depth":2,"charIndex":263},{"text":"报错后,看不到具体报错信息","id":"报错后看不到具体报错信息","depth":2,"charIndex":373},{"text":"Couldn't find any stories is your Storybook","id":"couldnt-find-any-stories-is-your-storybook","depth":2,"charIndex":538},{"text":"Storybook 添加 Proxy 功能","id":"storybook-添加-proxy-功能","depth":2,"charIndex":696},{"text":"Tailwind CSS 在 Storybook 中不生效","id":"tailwind-css-在-storybook-中不生效","depth":2,"charIndex":918}],"domain":"","frontmatter":{},"version":""},{"id":78,"title":"快速开始","content":"#\n\n\n三分钟快速上手#\n\n想要实际体验 Modern.js Module?首先你需要安装 Node.js LTS,并确保 Node 版本大于等于 16.0.0。我们推荐使用\nNode.js 18 的 LTS 版本。\n\n\n创建新项目#\n\n如果你想要创建一个完整的 Modern.js Module 项目,可以执行以下命令:\n\n\n\nINFO\n\n执行 npx @modern-js/create -h 查看更多命令行参数\n\n接着在问题交互中,按照如下选择:\n\n\n\n> 项目名称为 package.json 中的 \"name\" 字段值。\n\n接着就会开始初始化项目的流程。在项目目录和文件生成以及依赖安装完毕后,此时就创建了一个完整的 Modern.js Module 项目。\n\n我们可以直接执行 pnpm build 命令启动项目的构建,执行 pnpm build --watch 命令开启构建的观察模式。\n\n\n接入已有项目#\n\n在你的项目里安装以下依赖:\n\n * \"@modern-js/module-tools\"\n\n * \"typescript\"(如果不是 TypeScript 项目,则省略)\n\n> 对于使用 pnpm 或者 Yarn 包管理器的项目,只需要替换 npm 就可以了。推荐使用 pnpm。\n\n接着在项目的根目录下创建 modern.config.(t|j)s 文件:\n\n\n\n最后在项目的 package.json 文件里增加命令 \"build\": \"modern build\":\n\n\n\n如果你的项目存在 src/index.(js|jsx) 文件或者同时存在 src/index.(ts|tsx) 和 tsconfig.json\n文件,那么恭喜你可以运行直接运行 npm run build 来使用 Modern.js Module 构建你的项目了。\n\n\n核心 npm 包#\n\n@modern-js/module-tools 是 Modern.js Module 的核心 npm 包,主要提供以下能力:\n\n * 提供 modern dev, modern build 等常用的 CLI 命令。\n * 集成 Modern.js Core,提供配置解析、插件加载等能力。\n * 集成 esbuild 和 SWC,提供构建能力。\n * 集成一些最为常用的插件,比如 plugin-lint、plugin-changeset 等。\n\n@modern-js/module-tools 是基于 Modern.js 的插件体系实现的,本质上是一个插件,因此你需要在配置文件的 plugins\n字段中注册 moduleTools:\n\n\n\n\n查看官方示例#\n\n如果你想要看看使用了 Modern.js Module 的完整项目,可以执行以下命令:\n\n\n\n\n让我们开始吧#\n\n选择适合你的教程:\n\n * 我是初学者,需要学习 Modern.js Module 的基础使用。\n * 我已经初步掌握了 Modern.js Module 的使用,可以学习 Modern.js Module 的进阶指南。\n * 我需要扩展项目能力,需要学习如何开发 Modern.js Module 的插件。","routePath":"/module-tools/guide/intro/getting-started","lang":"zh","toc":[{"text":"三分钟快速上手","id":"三分钟快速上手","depth":2,"charIndex":3},{"text":"创建新项目","id":"创建新项目","depth":3,"charIndex":110},{"text":"接入已有项目","id":"接入已有项目","depth":3,"charIndex":402},{"text":"核心 npm 包","id":"核心-npm-包","depth":3,"charIndex":784},{"text":"查看官方示例","id":"查看官方示例","depth":3,"charIndex":1118},{"text":"让我们开始吧","id":"让我们开始吧","depth":2,"charIndex":1175}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":79,"title":"欢迎使用","content":"#\n\nModern.js Module 是 Modern.js\n的模块工程解决方案,同时也是核心依赖。它可以让开发者更轻松地构建、调试、发布模块类型的项目。模块类型的项目大多数情况可以认为是 npm\n包类型的项目,它可能是一个组件、组件库或者工具库项目。\n\n如果你正打算开发一个 npm 包类型的项目,那么你就来对地方了!Modern.js 提供了专业的模块工程解决方案。它带来了:\n\n * 简单的项目初始化:仅需执行 npx @modern-js/create project-dir\n 命令,然后进行几个交互问题,就可以创建一个完整的模块类型项目。创建的项目还支持选择 pnpm、Yarn 两种包管理器。\n * 代码格式化:在模块工程项目中,你可以执行 modern lint 来对代码进行格式化。同时初始化的模块工程项目里包含了 Modern.js 的\n ESLint 规则集,可以满足大部分场景下的需求。\n * 全面的构建能力和更快的构建速度:Modern.js Module 基于 esbuild 和 SWC\n 提供了高性能的构建能力,并且为不同构建模块的场景提供了丰富的配置。\n * Storybook 调试工具:Modern.js Module 为调试模块项目提供了 Storybook 调试工具。在安装了 Modern.js\n Module 的 Storybook 插件后,你可以使用 storybook dev 命令来启动它。你不仅可以使用 Storybook\n 对组件进行调试,也可以使用在其他类型的模块上。\n * 基于 Changesets 实现的版本管理:当需要对项目记录变更内容的时候,可以使用 modern change 命令生成包含变更内容的 Markdown\n 文件;当需要对项目进行版本升级的时候,可以使用 modern bump 命令通过 Markdown 文件分析并升级版本;当需要发布项目的时候,可以使用\n modern release 命令对项目进行发布。Modern.js Module 基于 Changesets 实现了这些命令。\n * 可扩展性的插件机制:想要为项目集成其他的调试工具?又或者是想要在构建过程中做一些额外处理?Modern.js Module\n 提供了插件机制和插件钩子,插件钩子覆盖了 dev 命令和 build 命令两个流程。你可以通过它们为项目进行能力的扩展。\n * 还有更多:Modern.js Module\n 在未来还会不断地在构建、调试功能上进行优化。如果在模块项目构建上存在需要解决的重要问题,又或者是某个主流的模块项目调试工具、模式出现的时候,那么它们很可能\n 成为 Modern.js Module 将要支持功能。","routePath":"/module-tools/guide/intro/welcome","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":80,"title":"为什么需要 Modern.js Module","content":"#\n\n大家可能都经历过:从零开始开发一个组件库或者工具库的过程中,我们不仅要考虑项目本身的代码逻辑如何编写,还要考虑项目的构建、调试、测试、代码格式化等等和代码逻辑无\n关的事情。\n\n比如说,当我们考虑构建模块项目的代码是使用什么构建工具的时候,在之前我们可能会考虑使用 webpack 还是 Rollup,然而现在的话,也许还会考虑是使用\nesbuild 还是 SWC。\n\n无论选择哪个构建工具,这对于没有熟练掌握这些构建工具使用方式的开发者来说,是需要一定的成本去学习的。即使想要快速使用,也会需要花费大量的时间和精力。\n\n而除了构建这件事情以外,像为项目提供调试工具、支持测试能力、增加代码格式校验等等,对于一个新手来说都有可能需要花费很长的时间和精力了解或者掌握它们,并且真正的服\n务于当前的项目中。\n\n而为了保证代码质量以及项目的完整性,我们往往是需要做这些与代码逻辑实现无关的事情。然而这些事情很有可能会影响整体的项目开发进度,降低开发者的开发体验,会让开发者\n感觉模块项目的开发门槛很高。\n\n如果说每次开发一个模块类型的项目都需要经历一遍这些工作准备的话,那么基本上刚开始开发的时间会大部分花费在这些与代码实现无关的事情上。如果能够提供一个模块工程解决\n方案,它能够帮助开发者解决项目工程上的事情,让开发者可以更专注于代码的实现上,那么这将会大大提升模块类型项目的开发体验。\n\n\n\nModern.js 为了让开发模块类型的项目更简单、解决上述提到的问题,提供了模块工程解决方案,并且通过 Modern.js Module\n提供了主要的功能。Modern.js Module 可以理解为是一个专门用于模块类型项目开发的工具。","routePath":"/module-tools/guide/intro/why-module-engineering-solution","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":82,"title":"快速开始","content":"#\n\nModern.js Module 不仅提供了丰富的功能,同时也支持通过插件的方式为当前项目扩展能力。\n\n我们可以通过下面的例子来快速了解如何编写一个 Modern.js Module 插件:\n\n 1. 首先我们在初始化的项目下创建 ./plugins/example.ts 文件。\n\n\n\n 2. 接着在 example.ts 文件中增加插件的代码。\n\n\n\n 3. 然后我们通过 plugins API,将刚刚写好的插件进行注册。\n\n\n\n 4. 最后运行 modern build,就可以看到:\n\n\n\n通过上面这个例子,我们了解到了下面几件事:\n\n * 推荐的插件目录结构\n * 插件的初始化代码\n * 插件的注册\n\n除了以上内容以外,我们还需要了解:\n\n * 插件对象、类型定义与推荐配置项\n * setup 函数、api 对象参数、生命周期钩子","routePath":"/module-tools/plugins/guide/getting-started","lang":"zh","toc":[],"domain":"","frontmatter":{"sidebar_position":1},"version":""},{"id":83,"title":"插件对象","content":"#\n\nModern.js Module 的插件是一个对象,对象包含以下属性:\n\n * name:插件的名称,唯一标识符。\n * setup:插件初始化函数,只会执行一次。setup 函数可以返回一个 Hooks 对象,Modern.js Module 会在特定的时机执行 Hooks\n 对象上定义的 Hook 对应的函数。\n\n例如在下面的插件代码示例中,在项目开始执行构建任务之前会触发 beforeBuild 函数的执行,并打印 build start 的 log 内容。\n\n\n\n\n\n\n插件类型定义#\n\n使用 TypeScript 时,可以引入内置的 CliPlugin 和 ModuleTools 类型,为插件提供正确的类型推导:\n\n\n\n\n插件配置项#\n\n建议将插件写成函数的形式,使插件能通过函数入参来接收配置项:\n\n","routePath":"/module-tools/plugins/guide/plugin-object","lang":"zh","toc":[{"text":"插件类型定义","id":"插件类型定义","depth":2,"charIndex":245},{"text":"插件配置项","id":"插件配置项","depth":2,"charIndex":323}],"domain":"","frontmatter":{"sidebar_position":2},"version":""},{"id":84,"title":"Setup 函数","content":"#\n\n在「插件对象」 部分我们知道插件对象包含了一个 setup 函数,该函数不仅包含了一个 api 对象参数,同时还可以返回一个 Hooks 对象。\n\n\n插件 API 对象#\n\n插件的 setup 函数会提供一个 api 对象参数,你可以调用该对象上提供的一些方法来获取到配置、项目上下文等信息。\n\n\n\n\napi.useAppContext#\n\n用于获取项目上下文信息。\n\n\n\nINFO\n\n通过实际的类型文件,我们可以看到还存在一些其他字段,不过目前对于 Modern.js Module 有意义的字段只有以上内容,api 对象其他的方法也是如此。\n\n\napi.useResolvedConfigContext#\n\n用于获取解析之后的最终配置。\n\nINFO\n\n如果需要获取构建相关的最终配置,需要使用 beforeBuild Hook。\n\n\n\n\napi.useHookRunners#\n\n用于获取 Hooks 的执行器,并触发特定的 Hook 执行。\n\n\n\n\n异步 setup#\n\nCLI 插件的 setup 可以是一个异步函数,在初始化过程中执行异步逻辑。\n\n\n\n注意,只有当前插件的 setup 异步函数执行完毕,才会继续执行下一个插件的 setup 函数。因此,你需要避免在 setup\n函数中进行耗时过长的异步操作,防止影响 CLI 启动性能。\n\n\n生命周期钩子#\n\n我们知道 setup 函数会返回一个 Hooks 对象,所谓 Hooks 对象也可以理解是具有 Modern.js Module 生命周期钩子的对象。\n\n目前主要包含两类钩子:\n\n * 构建钩子:仅在执行 build 命令构建源码产物时触发。\n * buildPlatform 钩子:仅在执行 build --platform 命令生成其他构建产物时触发。\n * 调试钩子:运行 dev 命令时会触发的钩子。\n\n关于生命周期钩子的完整列表参考 API 文档。","routePath":"/module-tools/plugins/guide/setup-function","lang":"zh","toc":[{"text":"插件 API 对象","id":"插件-api-对象","depth":2,"charIndex":77},{"text":"`api.useAppContext`","id":"apiuseappcontext","depth":3,"charIndex":-1},{"text":"`api.useResolvedConfigContext`","id":"apiuseresolvedconfigcontext","depth":3,"charIndex":-1},{"text":"`api.useHookRunners`","id":"apiusehookrunners","depth":3,"charIndex":-1},{"text":"异步 setup","id":"异步-setup","depth":2,"charIndex":430},{"text":"生命周期钩子","id":"生命周期钩子","depth":2,"charIndex":579}],"domain":"","frontmatter":{"sidebar_position":3},"version":""},{"id":85,"title":"总览","content":"#\n\n\n官方插件#\n\n * @modern-js/plugin-module-import:使用 SWC 提供与 babel-plugin-import 一样的能力。\n * @modern-js/plugin-module-banner:为每个 JS 和 CSS 文件的顶部和底部添加自定义内容,例如版权信息。\n * @modern-js/plugin-module-node-polyfill:会自动注入 Node 核心模块在浏览器端的 polyfills。\n * @modern-js/plugin-module-polyfill:为你的代码中使用到的不支持的功能注入 polyfill。\n * @modern-js/plugin-module-babel:使用 Babel 转换你的代码。\n * @modern-js/plugin-module-vue:提供对 Vue 3 组件构建的支持。","routePath":"/module-tools/plugins/official-list/overview","lang":"zh","toc":[{"text":"官方插件","id":"官方插件","depth":2,"charIndex":3}],"domain":"","frontmatter":{},"version":""},{"id":86,"title":"Babel 插件","content":"#\n\nTIP\n\n通常情况下,我们无需使用 Babel 转换我们的代码,此插件仅作为一种降级方式。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时需要打包 A,B 两个文件,并只需要在打包 A 时使用 babel:\n\n\n\n\n配置#\n\nSee Babel options\n\n下面是一个配置了@babel/preset-env的例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-babel","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":50},{"text":"安装","id":"安装","depth":3,"charIndex":58},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":64},{"text":"配置","id":"配置","depth":2,"charIndex":172}],"domain":"","frontmatter":{},"version":""},{"id":87,"title":"Banner 插件","content":"#\n\n提供为每个 JS 和 CSS 文件的顶部和底部注入内容的能力。\n\nTIP\n\n从 @modern-js/module-tools 2.36.0 版本开始,该插件功能内置在 Modern.js Module 中,由 banner 和\nfooter 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\nTIP\n\n注意:CSS 的注释不支持 //comment 这样的写法。详见「CSS 注释」\n\n\n示例#\n\n\n在 JS 文件顶部增加版权信息#\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nbanner#\n\n在顶部增加内容。\n\n * banner.js:在 JS 文件顶部增加内容。\n * banner.css:在 CSS 文件顶部增加内容。\n\n\nfooter#\n\n在底部增加内容。\n\n * footer.js:在 JS 文件底部增加内容。\n * footer.css:在 CSS 文件底部增加内容。","routePath":"/module-tools/plugins/official-list/plugin-banner","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":132},{"text":"安装","id":"安装","depth":3,"charIndex":140},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":146},{"text":"示例","id":"示例","depth":2,"charIndex":240},{"text":"在 JS 文件顶部增加版权信息","id":"在-js-文件顶部增加版权信息","depth":3,"charIndex":246},{"text":"配置","id":"配置","depth":2,"charIndex":267},{"text":"banner","id":"banner","depth":3,"charIndex":283},{"text":"footer","id":"footer","depth":3,"charIndex":362}],"domain":"","frontmatter":{},"version":""},{"id":88,"title":"Import 插件","content":"#\n\n提供与 babel-plugin-import 等价的能力和配置,基于 SWC 实现。\n\nTIP\n\n从 @modern-js/module-tools 2.16.0 版本开始,该插件功能内置在 Modern.js Module 中,由\ntransformImport 配置提供。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n这样我们就可以在 Modern.js Module 中使用自动导入的能力了。\n\n\n配置#\n\n * 类型:\n\n\n\n\npluginImport#\n\n * 类型:object[]\n\n其中数组元素为一个 babel-plugin-import 的配置对象。配置对象可以参考 options。\n\n使用示例:\n\n\n\n\n注意事项#\n\nSWC (Speedy Web Compiler) 是基于 Rust 语言编写的,而该插件是基于 SWC,移植自\nbabel-plugin-import,配置选项保持了一致。\n\n一些配置可以传入函数,例如 customName,customStyleName 等, 但在 Modern.js Module\n里,我们不建议在此配置项里使用函数。 因为我们会在 esbuild 的插件里调用 SWC,然后再当 Rust 通过 Node-API\n调用这些配置函数时,会出现死锁现象。\n\n简单的函数逻辑其实可以通过模版语言来代替,下面是一个 customName 使用模板的示例:\n\n\n\n添加以下配置:\n\n\n\n其中的 {{ member }} 会被替换为相应的引入成员,转换后:\n\n\n\n可以看出配置 customName: \"foo/es/{{ member }}\" 的效果等同于配置 customName: (member) =>\n`foo/es/${member}` 。\n\n这里使用到的模版是 handlebars,模版配置中还内置了一些有用的辅助工具,还是以上面的导入语句为例,配置成:\n\n\n\n会转换成下面的结果:\n\n\n\n除了 kebabCase 以外还有 camelCase,snakeCase,upperCase,lowerCase 可以使用。","routePath":"/module-tools/plugins/official-list/plugin-import","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":144},{"text":"安装","id":"安装","depth":3,"charIndex":152},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":158},{"text":"配置","id":"配置","depth":2,"charIndex":245},{"text":"pluginImport","id":"pluginimport","depth":3,"charIndex":261},{"text":"注意事项","id":"注意事项","depth":2,"charIndex":357}],"domain":"","frontmatter":{},"version":""},{"id":89,"title":"Node Polyfill 插件","content":"#\n\nNode Polyfill 介绍\n\n通常情况下,我们不会在浏览器端使用 Node 模块。但在当前代码需要同时在 Node 端和浏览器端运行时,用到一些 Node 模块是有可能的。Node\nPolyfill 为这些 Node 模块提供了浏览器版本的 polyfills。\n\n通过使用 Node Polyfill 插件,会自动注入 Node 核心模块在浏览器端的 polyfills,让你可以在浏览器端放心使用这些模块。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\nexclude#\n\n排除要注入的 Node Polyfill。\n\n\n\n\noverrides#\n\n覆盖内置的 Node Polyfill。\n\n\n\n\nNode Polyfills#\n\n\nGlobals#\n\n * Buffer\n * process\n * console\n\n当你在代码中使用以上全局变量时,对应 polyfill 会被自动注入。\n\n\n\n\nModules#\n\n * assert\n * buffer\n * console\n * constants\n * crypto\n * domain\n * events\n * http\n * https\n * os\n * path\n * punycode\n * process\n * querystring\n * stream\n * _stream_duplex\n * _stream_passthrough\n * _stream_readable\n * _stream_transform\n * _stream_writable\n * string_decoder\n * sys\n * timers\n * tty\n * url\n * util\n * vm\n * zlib\n\n当你通过 require 或 import 等语法在代码中引用以上模块时,对应 polyfill 会被注入。\n\n\n\n\nFallbacks#\n\n * child_process\n * cluster\n * dgram\n * dns\n * fs\n * module\n * net\n * readline\n * repl\n * tls\n\n目前浏览器端没有以上模块的 polyfill,因此当你引用以上模块时,会自动 fallback 为一个空对象。\n\n","routePath":"/module-tools/plugins/official-list/plugin-node-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":213},{"text":"安装","id":"安装","depth":3,"charIndex":221},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":227},{"text":"配置","id":"配置","depth":2,"charIndex":274},{"text":"exclude","id":"exclude","depth":3,"charIndex":290},{"text":"overrides","id":"overrides","depth":3,"charIndex":326},{"text":"Node Polyfills","id":"node-polyfills","depth":2,"charIndex":363},{"text":"Globals","id":"globals","depth":3,"charIndex":381},{"text":"Modules","id":"modules","depth":3,"charIndex":464},{"text":"Fallbacks","id":"fallbacks","depth":3,"charIndex":860}],"domain":"","frontmatter":{},"version":""},{"id":90,"title":"Polyfill 插件","content":"#\n\nTIP\n\n通常情况下,我们不需要为 npm 包注入 polyfill,这一步应该在 Web\n应用的框架侧完成,但是在某些场景,为了让我们的库能够直接运行在低版本浏览器里,我们需要注入 polyfill。\n\n请注意,此插件并不会转化你的代码语法,只会为你的代码中使用到的不支持的功能注入 polyfill,把它们作为普通函数导入而不是污染全局。你需要安装\ncore-js-pure 依赖\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n你也可以通过 hooks 配置注册,例如你同时具有多份构建配置,并只需要在 bundle 构建时注入 polyfill:\n\n\n\n\n配置#\n\n * 类型:\n\n\n\n\ntargets#\n\n参考 Babel target.\n\n下面是一个例子:\n\n","routePath":"/module-tools/plugins/official-list/plugin-polyfill","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":197},{"text":"安装","id":"安装","depth":3,"charIndex":205},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":211},{"text":"配置","id":"配置","depth":2,"charIndex":322},{"text":"targets","id":"targets","depth":3,"charIndex":338}],"domain":"","frontmatter":{},"version":""},{"id":91,"title":"Vue 插件","content":"#\n\nVue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 esbuild-plugin-vue3 和 @vue/babel-plugin-jsx。\n\nWARNING\n\n请注意,此插件仍有一些用法限制:\n\n 1. 目前此插件的实现是直接集成社区插件,因此不支持在 sfc 里写 jsx/tsx。\n 2. 如果要为组件生成 d.ts,请使用官方推荐方式 vue-tsc。\n 3. 仅支持打包场景,推荐将 input 设置为 ['src/**/*.vue'] 或者 ['src/index.ts']。\n\n\n快速开始#\n\n\n安装#\n\n\n注册插件#\n\n在 Modern.js Module 中,你可以按照如下方式注册插件:\n\n\n\n\n配置#\n\n\nvueJsxPluginOptions#\n\n * Type:\n\n\n\n * Default: {}\n\n传递给 @vue/babel-plugin-jsx 的选项,请查阅 @vue/babel-plugin-jsx 文档 来了解具体用法。","routePath":"/module-tools/plugins/official-list/plugin-vue","lang":"zh","toc":[{"text":"快速开始","id":"快速开始","depth":2,"charIndex":256},{"text":"安装","id":"安装","depth":3,"charIndex":264},{"text":"注册插件","id":"注册插件","depth":3,"charIndex":270},{"text":"配置","id":"配置","depth":2,"charIndex":317},{"text":"vueJsxPluginOptions","id":"vuejsxpluginoptions","depth":3,"charIndex":323}],"domain":"","frontmatter":{},"version":""}] \ No newline at end of file