Files
zhdiary/packages/web/nuxt.config.ts
T

115 lines
2.5 KiB
TypeScript

import { Configuration } from '@nuxt/types'
import tag from './static/build/tag/posts.json'
import posts from './static/build/header/posts.json'
const config: Configuration = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: '中文 Diary',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' },
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
],
script: [
{ src: 'https://platform.twitter.com/widgets.js', async: true, charset: 'utf-8' },
],
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
'@fortawesome/fontawesome-svg-core/styles.css',
'~/assets/app.scss',
],
/*
** Plugins to load before mounting the App
*/
plugins: [
'~/plugins/disqus',
'~/plugins/fontawesome',
],
/*
** Nuxt.js dev-modules
*/
buildModules: [
'@nuxt/typescript-build',
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://buefy.github.io/#/documentation
['nuxt-buefy', {
materialDesignIcons: false,
defaultIconPack: 'fa',
defaultIconComponent: 'fa',
}],
['nuxt-mq', {
defaultBreakpoint: 'desktop',
breakpoints: {
mobile: 500,
tablet: 1024,
desktop: Infinity,
},
}],
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'nuxt-payload-extractor',
['@nuxtjs/google-analytics', {
id: 'UA-146246917-2',
}],
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend (config, ctx) {
config.module?.rules!.push({
test: /\.md$/,
use: [
'raw-loader',
],
})
},
},
generate: {
routes: [
...Object.keys(tag).map((el) => `/tag/${el}`),
...Object.values(posts).map((el) => {
return el.y && el.mo ? `/post/${el.y}/${el.mo}/${el.name}` : `/post/${el.name}`
}),
],
fallback: true,
},
env: {
title: '中文 Diary',
tags: JSON.stringify(tag),
hash: JSON.stringify({
posts: require('./static/build/hash/posts.json'),
slides: require('./static/build/hash/slides.json'),
}),
},
}
export default config