-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnuxt.config.ts
105 lines (95 loc) · 2.3 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
import type { NuxtConfig } from 'nuxt/config';
const getUrl = () => {
let siteUrl =
process?.env?.NUXT_PUBLIC_SITE_URL ?? // Set this to your site URL in production env.
process?.env?.NUXT_ENV_VERCEL_URL ?? // Automatically set by Vercel.
'http://localhost:3000/';
// Make sure to include `https://` when not localhost.
siteUrl = siteUrl.includes('http') ? siteUrl : `https://${siteUrl}`;
// Make sure to including trailing `/`.
siteUrl = siteUrl.charAt(siteUrl.length - 1) === '/' ? siteUrl : `${siteUrl}/`;
return siteUrl;
};
const runtimeConfig: NuxtConfig['runtimeConfig'] = {
host: getUrl(),
public: {
GQL_HOST: `${getUrl()}api/graphql`,
},
};
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
runtimeConfig,
css: [
'primevue/resources/themes/tailwind-light/theme.css',
'primevue/resources/primevue.css',
'primeicons/primeicons.css',
'@/assets/styles/main.css', // NOTE: ORDER IS IMPORTANT HERE, WE MUST BE ABLE TO OVERRIDE PRIMEVUE STYLES
],
srcDir: 'src/',
imports: {
dirs: ['./store/**', './composables/**'],
},
build: {
transpile: ['primevue'],
},
modules: [
'@nuxt/devtools',
'@nuxtjs/eslint-module',
'@vueuse/nuxt',
'@nuxt/image-edge',
'nuxt-typed-router',
[
'@nuxtjs/tailwindcss',
{
cssPath: '~/assets/styles/tailwind.css',
},
],
[
'@nuxtjs/google-fonts',
{
families: {
Inter: true,
},
},
],
[
'@pinia/nuxt',
{
autoImports: ['defineStore', 'storeToRefs'],
},
],
'nuxt-icon',
'@nuxtjs/web-vitals',
'nuxt-lodash',
[
'nuxt-graphql-server',
{
url: runtimeConfig.public?.GQL_HOST,
schema: './src/server/**/*.graphql',
codegen: {
enumValues: '~/enums/index',
contextType: '~/server/graphql/IGraphQLContext#IGraphQLContext',
},
},
],
[
'@nuxtjs/apollo',
{
autoImports: true,
clients: {
default: {
httpEndpoint: runtimeConfig.public?.GQL_HOST,
},
},
},
],
],
postcss: {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
},
});