-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathnuxt.config.ts
179 lines (164 loc) · 4.92 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import { constructConfig } from './config'
export default defineNuxtConfig({
/*
** Add alias for library imports
** https://v3.nuxtjs.org/guide/going-further/esm#aliasing-libraries
*/
alias: {
// Support `import 'global'` used by storybook
// TODO: Remove this workaround once nuxt provides a proper polyfill for globals https://github.com/nuxt/framework/issues/1922
global: 'global.ts',
},
nitro: {
// Prevent 'reflect-metadata' from being treeshaked (since we don't explicitly use the import it would otherwise be removed)
moduleSideEffects: ['reflect-metadata'],
prerender: {
// Needed for storybook support
routes: ['/_storybook/external-iframe'],
},
},
/*
** Disable server-side rendering for now
** See https://v3.nuxtjs.org/api/configuration/nuxt.config#ssr
** and https://v3.nuxtjs.org/guide/concepts/rendering for a big-picture overview.
*/
ssr: false,
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
meta: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || '',
},
// This is necessary to fix issues with tailwind/naive-ui: https://www.naiveui.com/en-US/light/docs/style-conflict
{
name: 'naive-ui-style',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
** Global CSS
*/
css: [
// FontAwesome support
'@fortawesome/fontawesome-svg-core/styles.css',
],
/*
** Nuxt.js modules
*/
modules: [
// https://go.nuxtjs.dev/tailwindcss
'@nuxtjs/tailwindcss',
// Add support for naive-ui
'@huntersofbook/naive-ui-nuxt',
// Use Pinia for state management
'@pinia/nuxt',
// Add storybook support
'./modules/storybook',
// Add server-side graphql support
'nuxt-graphql-server',
// Add vue runtime compiler as temporary workaround for https://github.com/nuxt/framework/issues/4661
'nuxt3-runtime-compiler-module',
// Add support for writing content in markdown
// https://content.nuxtjs.org/
'@nuxt/content',
],
/*
** Client and server-side configuration
** See https://v3.nuxtjs.org/guide/features/runtime-config
*/
runtimeConfig: constructConfig(),
/**
* Add redirects, mostly for backwards compatibility
*/
routeRules: {
'/faq': { redirect: 'https://docs.jabref.org/faq' },
'/paypal': { redirect: '/donations' },
'/donations': {
redirect: 'https://github.com/JabRef/jabref/wiki/Donations/',
},
'/gsoc/**': { redirect: '/codeprojects/gsoc' },
'/bluehat2022': { redirect: '/codeprojects/bluehat2022' },
'/surveys/': { redirect: '/surveys/2015' },
},
/**
* Storybook integration with Nuxt
* See https://storybook.nuxtjs.org/
*/
storybook: {},
tailwindcss: {
// Expose config so that we can use it in the vscode extension
exposeConfig: true,
},
/**
* GraphQL server config
* See https://github.com/tobiasdiez/nuxt-graphql-server
*/
graphqlServer: {
codegen: {
mapperTypeSuffix: 'Model',
contextType: './context#Context',
mappers: {
User: '@prisma/client/index.d#User',
Document: './documents/user.document.service#UserDocument',
JournalArticle: './documents/user.document.service#UserDocument',
ProceedingsArticle: './documents/user.document.service#UserDocument',
Thesis: './documents/user.document.service#UserDocument',
Other: './documents/user.document.service#UserDocument',
Group: './groups/resolvers#GroupMaybeResolved',
},
scalars: {
Date: 'string',
DateTime: 'Date',
EmailAddress: 'string',
},
},
},
content: {
markdown: {
// Don't automatically print h2-h4 headings as links
anchorLinks: false,
},
},
/**
* Naive UI configuration
*/
naiveUI: {
themeOverrides: {
common: {
primaryColor: '#6072A7',
primaryColorHover: '#4F5F8F',
primaryColorPressed: '#3B476B',
primaryColorSuppl: '#4F5F8F',
},
},
},
vite: {
server: {
// Configure vite for HMR with Gitpod
// Taken from https://github.com/vitejs/vite/issues/1653#issuecomment-1079322770
hmr: process.env.GITPOD_WORKSPACE_URL
? {
// Gitpod is served over https, so we need to use wss as well
protocol: 'wss',
host: `3000-${process.env.GITPOD_WORKSPACE_ID || ''}.${
process.env.GITPOD_WORKSPACE_CLUSTER_HOST || ''
}`,
port: 443,
}
: true,
// Without this, vite would handle cors in dev mode, which would lead to different behavior in dev and prod
cors: {
preflightContinue: true,
},
},
},
})