autoPages

add in v3.0.0-rc.10
TIP

After startup, automatically find entry files in the pages directory

  • Type: boolean | {path:'pages'}
  • Default: false
emp-config.js
import {defineConfig} from '@empjs/cli'
export default defineConfig(store => {
  return {
    autoPages:true
  }
})

Purpose

  • Capture all files under the src/pages directory and configure the html-template according to the html and entries settings, for example:
emp-config.js
import {defineConfig} from '@empjs/cli'
import pluginReact from '@empjs/plugin-react'

export default defineConfig(store => {
  return {
    //开启 autoPages
    autoPages: true,
    plugins: [pluginReact()],
    // 全局设置 html 配置
    html: {
      title: 'EMP v3 Auto Pages',
    },
    // 局部设置存在页面的配置
    entries: {
      'work/index.ts': {
        title: 'auto page work',
      },
    },
  }
})
目录