import * as path from 'path' import globs from 'globs' import { PageConfig } from '../intf/vue-project-options' const resolve = (dir: string) => path.join(process.cwd(), dir) /** 根据 ./src/main.(jt)s 加载默认入口 */ export const createDefaultPage = (): PageConfig => { let entry = globs.sync(resolve('src/main.*'))[0] if (!entry) throw new Error(`Error: 缺少项目入口 'main.js'.`) entry = path.resolve(process.cwd(), entry) return { app: { entry, template: 'public/index.html', filename: 'index.html' } } }