[READ-ONLY] Mirror of https://github.com/danielroe/netlify-dynamic-builder.
0

Configure Feed

Select the types of activity you want to include in your feed.

netlify-dynamic-builder / nuxt.config.ts
1.1 kB 35 lines
1import { join } from 'pathe' 2import { existsSync, readFileSync, writeFileSync } from 'fs' 3 4// https://v3.nuxtjs.org/api/configuration/nuxt.config 5export default defineNuxtConfig({ 6 nitro: { 7 routes: { 8 '/articles': { swr: 360 }, 9 '/blog/**': { static: true }, 10 }, 11 hooks: { 12 async 'compiled' (nitro) { 13 if (nitro.options.dev) return 14 15 const redirectsPath = join(nitro.options.output.publicDir, '_redirects') 16 let contents = '/* /.netlify/functions/server 200' 17 if (existsSync(redirectsPath)) { 18 contents = readFileSync(redirectsPath, 'utf-8') 19 } 20 for (const [key] of Object.entries(nitro.options.routes).filter(([_, value]) => value.swr || value.static)) { 21 contents = `${key.replace('/**', '/*')}\t/.netlify/builders/server 200\n` + contents 22 } 23 writeFileSync(redirectsPath, contents) 24 }, 25 } 26 }, 27 hooks: { 28 'nitro:config' (nitroOptions) { 29 if (nitroOptions.dev) return 30 31 nitroOptions.entry = '~/dynamic-builder' 32 nitroOptions.preset = 'netlify' 33 }, 34 }, 35})