For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/configure/app/source/main-entry-name.md.
  • 简体中文
  • source.mainEntryName

    • 类型: string
    • 默认值: 'index'

    该选项用于配置 Modern.js 的主入口名称。

    默认情况下,Modern.js 的默认主入口名称为 index,当使用单入口或者入口名称和 package.json 中 name 字段一致时,会将对应入口作为主入口,通过该配置可以修改主入口的名称。

    比如将主入口名称改为 main:

    modern.config.ts
    export default defineConfig({
      source: {
        mainEntryName: 'main',
      },
    });

    构建之后,对应 html 产物路径将会变为 dist/html/index/index.html。

    Info

    当修改主入口名称后,其他 **ByEntries 的配置也需要对应调整使用修改后的入口名称。