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/entries-dir.md.
  • 简体中文
  • source.entriesDir

    • 类型: string
    • 默认值: './src'

    Modern.js 默认会扫描 src 目录来识别页面入口,你可以通过该选项自定义页面入口的识别目录。

    例如,当配置与目录结构如下时:

    modern.config.ts
    export default defineConfig({
      source: {
        entriesDir: './src/pages',
      },
    });
    项目目录结构
    .
    └── src
        └── pages
            ├── a
            │   └── App.tsx
            └── b
                └── App.tsx

    Modern.js 会扫描 ./src/pages 目录,自动生成构建入口 a 和入口 b,结果如下:

    const entry = {
      a: './src/pages/a/App.tsx',
      b: './src/pages/b/App.tsx',
    };