Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt. roe.dev
Something went wrong. Try again.
roe.dev nuxt.config.ts
7.1 kB · 340 lines
TypeScript
at feat/sentry
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341import process from 'node:process'
import { defineNuxtConfig } from 'nuxt/config'import { useNuxt } from 'nuxt/kit'import { isTest } from 'std-env'import type { HmrOptions } from 'vite'
export default defineNuxtConfig({ modules: [ '@sentry/nuxt/module', '@nuxtjs/sanity', 'nuxt-og-image', '@nuxt/eslint', 'nuxt-time', '@nuxt/test-utils/module', 'magic-regexp/nuxt', '@nuxt/image', '@nuxtjs/html-validator', '@unocss/nuxt', '@nuxtjs/color-mode', '@nuxt/content', '@nuxtjs/plausible', '@nuxt/fonts', '@nuxt/scripts', function (_options, nuxt) { // todo: refactor into nuxt nuxt.hook('prepare:types', ctx => { ctx.tsConfig.include = ctx.tsConfig.include?.filter(i => i !== '..' && i !== '../**/*') }) }, ],
// TODO: remove when Nuxt v3.14 is released $development: { modules: [ function (_options, nuxt) { if (process.env.IDX_CHANNEL) { nuxt.hook('modules:done', () => { nuxt.options.vite.server ||= {} nuxt.options.vite.server.hmr ||= {} ;(nuxt.options.vite.server.hmr as HmrOptions).protocol = 'wss' }) } }, ], },
$production: { modules: ['nuxt-security'], experimental: { noVueServer: true, }, image: { provider: 'ipxStatic', }, },
$test: { modules: [ function (_options, nuxt) { nuxt.hook('vite:extendConfig', config => { config.plugins = config.plugins?.filter(p => !p || !('name' in p) || p.name !== 'nuxt:scripts:bundler-transformer') }) }, ], experimental: { componentIslands: true, }, },
devtools: { enabled: true },
app: { head: { htmlAttrs: { lang: 'en' }, title: 'Daniel Roe', }, pageTransition: false, layoutTransition: false, },
css: ['@unocss/reset/tailwind.css', '~/assets/main.css'],
site: { url: 'https://roe.dev', },
content: { watch: false, highlight: { preload: ['js', 'ts', 'json', 'vue'], theme: 'material-theme-palenight', }, },
runtimeConfig: { sanity: { token: '', }, cloudflare: { s3Url: '', r2TokenId: '', r2TokenKey: '', }, voteUrl: '', sessionPassword: '', // emailing ideas resendApiKey: '', twitch: { clientId: '', clientSecret: '', }, typefully: { apiKey: '', }, github: { // my GH ID id: 'MDQ6VXNlcjI4NzA2Mzcy', // fetching GH repos in build and sponsors when deployed token: '', // oauth flow clientSecret: '', inviteToken: '', }, public: { sentry: { dsn: '', }, githubClientId: '', }, },
routeRules: { '/api/hi': { cors: true }, '/feed.xml': { redirect: '/rss.xml' }, '/thumbnail/**': { cache: { maxAge: 60 * 60 * 24 * 365 } }, '/chat': { redirect: 'https://roe.dev/blog/open-invitation' }, '/.well-known/webfinger/**': { redirect: { to: 'https://mastodon.roe.dev/.well-known/webfinger/**', statusCode: 301, }, }, },
sourcemap: { client: true },
future: { compatibilityVersion: 4, },
experimental: { buildCache: false, defaults: { nuxtLink: { trailingSlash: 'append', }, useAsyncData: { deep: false, }, }, cookieStore: true, headNext: true, viewTransition: true, typedPages: true, },
compatibilityDate: '2024-09-19',
nitro: { replace: { 'import.meta.test': isTest, }, future: { nativeSWR: true }, prerender: { crawlLinks: true, routes: ['/', '/rss.xml', '/voted/', '/work/', '/feedback/', '/ama/', '/ai/'], }, hooks: { 'prerender:generate' (route) { if (route.fileName) route.fileName = route.fileName.replace( /(\.\w{3})\/index.html$/, '$1', )
if (route.error) { if (route.route.startsWith('/_ipx')) { console.warn('Could not prerender', route.route) // ignore IPX rendering errors delete route.error } else { console.error(route.route, route.error, route) process.exit(1) } } }, }, },
vite: { vue: { features: { optionsAPI: false, }, }, },
typescript: { // TODO: remove nitropack/types when nuxt v3.14 is released hoist: ['vite', 'nitropack/types'], },
postcss: { plugins: { 'postcss-nesting': {}, '@unocss/postcss': {}, }, },
hooks: { 'components:extend' (components) { // This code ensures that we can run our markdown renderer on the // client side in development mode (for HMR). const nuxt = useNuxt() for (const comp of components) { if (comp.pascalName === 'StaticMarkdownRender' && nuxt.options.dev) { comp.mode = 'all' } } }, },
devTo: { enabled: !!process.env.SYNC_DEV_TO, },
eslint: { config: { stylistic: true, }, },
htmlValidator: { failOnError: true, options: { rules: { 'unrecognized-char-ref': 'off', 'wcag/h37': 'warn', 'element-permitted-content': 'warn', 'element-required-attributes': 'warn', 'attribute-empty-style': 'off', }, }, },
image: { domains: [ 'www.dundeescript.co.uk', 'devoxx.gr', 'conference.vueschool.io', 'static-cdn.jtvnw.net', 'avatars.githubusercontent.com', 'raw.githubusercontent.com', 's3.nl-ams.scw.cloud', 'cdn.bsky.social', 'cdn.bsky.app', 'images.jsworldconference.com', 'www.middlesbroughfe.co.uk', 'res.cloudinary.com', 'cityjsconf.org', 'vuejsnation.com', 'vueconf.us', 'media.graphassets.com', 'secure.meetupstatic.com', 'cdn.evbuc.com', 'conf.vuejs.de', 'pragvue.com', 'www.scotlandis.com', 'conf.vuejs.de', 'perfnow.nl', 'www.vuetoronto.com', 'gdg.community.dev', ], screens: { logo: 40, avatar: 70, 380: 380, 760: 760, }, },
ogImage: { zeroRuntime: true, fonts: [ 'Barlow:400', 'Barlow:600', ], },
plausible: { domain: 'roe.dev', apiHost: 'https://v.roe.dev', },
scripts: { defaultScriptOptions: { bundle: true, }, },
security: { headers: { crossOriginEmbedderPolicy: false, contentSecurityPolicy: { 'script-src-attr': ['\'self\'', '\'unsafe-inline\''], 'img-src': ['\'self\'', 'data:', 'https://avatars.githubusercontent.com'], }, }, },
sentry: { sourceMapsUploadOptions: { org: 'poetryco', project: 'roe-dev', }, },
social: { networks: { bluesky: { identifier: 'danielroe.dev', }, mastodon: { identifier: 'daniel@roe.dev', }, }, },})