jointrashposs/nuxt.config.ts

136 lines
2.7 KiB
TypeScript
Raw Normal View History

2023-07-08 10:36:02 +02:00
// https://nuxt.com/docs/api/configuration/nuxt-config
import ViteYaml from '@modyfi/vite-plugin-yaml';
import svgLoader from 'vite-svg-loader';
import genSitemap from './scripts/gen-sitemap';
2023-07-17 18:44:06 +02:00
import { genApiTranslationFiles } from './scripts/gen-api-translations';
2023-11-06 17:21:48 +01:00
import type { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
2023-07-08 10:36:02 +02:00
2023-07-10 19:54:13 +02:00
// 公開時のドメイン(末尾スラッシュなし)
const baseUrl = 'https://misskey-hub.net';
2023-11-06 17:21:48 +01:00
// 言語定義
2023-07-17 18:44:06 +02:00
export const locales = [
2023-07-11 19:19:32 +02:00
{ code: 'ja', iso: 'ja-JP', name: '日本語' },
{ code: 'en', iso: 'en-US', name: 'English' },
2023-10-29 15:47:46 +01:00
{ code: 'id', iso: 'id-ID', name: 'Bahasa Indonesia' },
2023-07-11 19:19:32 +02:00
{ code: 'ko', iso: 'ko-KR', name: '한국어' },
{ code: 'it', iso: 'it-IT', name: 'Italiano' },
{ code: 'pl', iso: 'pl-PL', name: 'Polski' },
{ code: 'fr', iso: 'fr-FR', name: 'Français' },
2023-10-29 15:47:46 +01:00
{ code: 'cn', iso: 'zh-CN', name: '简体中文' },
{ code: 'tw', iso: 'zh-TW', name: '繁体中文' },
2023-11-06 17:21:48 +01:00
] as LocaleObject[];
2023-07-11 19:19:32 +02:00
2023-07-08 10:36:02 +02:00
export default defineNuxtConfig({
2023-07-10 19:54:13 +02:00
runtimeConfig: {
2023-10-01 06:11:13 +02:00
locales,
2023-07-10 19:54:13 +02:00
public: {
baseUrl,
}
},
2023-07-08 10:36:02 +02:00
css: [
2023-07-10 19:54:13 +02:00
"github-markdown-css/github-markdown.css",
2023-10-29 14:02:27 +01:00
"@/assets/css/nprogress.css",
2023-07-08 10:36:02 +02:00
"@/assets/css/tailwind.css",
2023-07-09 11:58:53 +02:00
"@/assets/css/bootstrap-forms.scss",
2023-07-08 10:36:02 +02:00
],
modules: [
'@nuxt/content',
'@nuxtjs/i18n',
2023-07-08 19:23:27 +02:00
'@nuxtjs/color-mode',
2023-07-08 10:36:02 +02:00
],
app: {
head: {
link: [
{ rel: 'stylesheet', href: '/fonts/fonts.css' },
],
},
},
2023-07-10 19:54:13 +02:00
content: {
navigation: {
fields: [
'date',
'description',
2023-07-10 19:54:13 +02:00
]
2023-07-17 18:44:06 +02:00
},
highlight: {
2023-11-06 17:21:48 +01:00
preload: [
'ini',
],
2023-07-17 18:44:06 +02:00
theme: {
// Default theme (same as single string)
default: 'github-light',
// Theme used if `html.dark`
dark: 'github-dark',
},
},
2023-07-10 19:54:13 +02:00
},
2023-07-08 10:36:02 +02:00
i18n: {
2023-07-10 19:54:13 +02:00
baseUrl,
2023-07-08 10:36:02 +02:00
vueI18n: './i18n.config.ts',
2023-07-11 19:19:32 +02:00
locales,
2023-07-08 10:36:02 +02:00
defaultLocale: 'ja',
strategy: 'prefix',
2023-09-29 13:30:27 +02:00
detectBrowserLanguage: {
fallbackLocale: 'ja',
},
trailingSlash: true,
2023-07-08 10:36:02 +02:00
},
2023-07-08 19:23:27 +02:00
colorMode: {
classSuffix: '',
},
2023-07-08 10:36:02 +02:00
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
alias: {
'bi': 'bootstrap-icons/icons',
},
vite: {
plugins: [
ViteYaml(),
svgLoader({
defaultImport: 'component',
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
}
}
}
]
}
}),
]
},
nitro: {
hooks: {
'compiled': genSitemap,
},
prerender: {
routes: [
"/404.html"
2023-07-13 18:10:25 +02:00
],
// 【一時対応】とりあえずビルドできるようにする
failOnError: false,
2023-07-08 10:36:02 +02:00
},
plugins: [
'@/server/plugins/appendComment.ts',
2023-09-29 13:30:27 +02:00
'@/server/plugins/i18nRedirector.ts',
2023-07-08 10:36:02 +02:00
],
2023-07-13 18:27:48 +02:00
},
2023-07-17 18:44:06 +02:00
hooks: {
'build:before': genApiTranslationFiles,
},
2023-07-13 18:27:48 +02:00
experimental: {
inlineSSRStyles: false,
2023-07-15 10:44:29 +02:00
payloadExtraction: true,
2023-09-28 12:29:11 +02:00
componentIslands: true,
2023-07-13 18:27:48 +02:00
},
2023-07-08 10:36:02 +02:00
})