-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathnuxt.config.ts
87 lines (75 loc) · 2.66 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
import { createResolver } from '@nuxt/kit';
const { resolve } = createResolver(import.meta.url);
export default defineNuxtConfig({
compatibilityDate: '2024-12-26',
future: {
compatibilityVersion: 4,
},
app: {
head: {
htmlAttrs: { lang: 'en' },
link: [{ rel: 'icon', href: '/logo.svg', type: 'image/svg+xml' }],
},
pageTransition: { name: 'page', mode: 'default' },
},
experimental: {
sharedPrerenderData: true,
buildCache: true,
defaults: {
nuxtLink: {
prefetch: true,
prefetchOn: { visibility: false },
},
},
},
plugins: [resolve('./app/plugins/init.ts')],
components: [{ path: resolve('./app/components'), pathPrefix: false }],
modules: ['woonuxt-settings', 'nuxt-graphql-client', '@nuxtjs/tailwindcss', '@nuxt/icon', '@nuxt/image', '@nuxtjs/i18n'],
'graphql-client': {
clients: {
default: {
host: process.env.GQL_HOST || 'http://localhost:4000/graphql',
corsOptions: { mode: 'cors', credentials: 'include' },
headers: { 'Origin': process.env.APP_HOST || 'http://localhost:3000' },
},
},
},
alias: {
'#constants': resolve('./app/constants'),
'#woo': '../.nuxt/gql/default',
},
hooks: {
'pages:extend'(pages) {
const addPage = (name: string, path: string, file: string) => {
pages.push({ name, path, file: resolve(`./app/pages/${file}`) });
};
addPage('product-page-pager', '/products/page/:pageNumber', 'products.vue');
addPage('product-category-page', '/product-category/:categorySlug', 'product-category/[slug].vue');
addPage('product-category-page-pager', '/product-category/:categorySlug/page/:pageNumber', 'product-category/[slug].vue');
addPage('order-received', '/checkout/order-received/:orderId', 'order-summary.vue');
addPage('order-summary', '/order-summary/:orderId', 'order-summary.vue');
},
},
nitro: {
routeRules: {
'/': { prerender: true },
'/products/**': { swr: 3600 },
'/checkout/order-received/**': { ssr: false },
'/order-summary/**': { ssr: false },
},
},
// Multilingual support
i18n: {
locales: [
{ code: 'en_US', file: 'en-US.json', name: 'English 🇺🇸' },
{ code: 'de_DE', file: 'de-DE.json', name: 'Deutsch 🇩🇪' },
{ code: 'es_ES', file: 'es-ES.json', name: 'Español 🇪🇸' },
{ code: 'fr_FR', file: 'fr-FR.json', name: 'Français 🇫🇷' },
{ code: 'it_IT', file: 'it-IT.json', name: 'Italiano 🇮🇹' },
{ code: 'pt_BR', file: 'pt-BR.json', name: 'Português 🇧🇷' },
],
langDir: 'locales',
defaultLocale: 'en_US',
strategy: 'no_prefix',
},
});