Record<string, boolean | object>undefined在多入口应用中,为每个入口分别配置 SSG。
output.ssg。output.ssgByEntries。output.ssg 为 true 且未配置 output.ssgByEntries 时,所有入口下的所有路由都会作为 SSG 路由处理。type SSGRouteOptions =
| string
| {
url: string;
headers?: Record<string, any>;
};
type SSGOptions = {
headers?: Record<string, any>;
routes?: SSGRouteOptions[];
};
// ssgByEntries 类型
type SSGMultiEntryOptions = Record<string, boolean | SSGOptions>;export default defineConfig({
output: {
ssgByEntries: {
home: true,
admin: false,
},
},
});export default defineConfig({
output: {
ssgByEntries: {
home: {
routes: ['/', '/about', '/user/modernjs'],
},
admin: {
routes: ['/', '/dashboard'],
},
},
},
});export default defineConfig({
output: {
ssgByEntries: {
home: {
headers: {
'x-tt-env': 'ppe_modernjs',
},
routes: [
'/',
{
url: '/about',
headers: {
from: 'modern-website',
},
},
],
},
},
},
});