-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnuxt.config.ts
78 lines (74 loc) · 1.94 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
import { NuxtConfig } from '@nuxt/types';
import { build } from './config/build.config';
import head from './config/head.config';
import { modules } from './config/modules.config';
import { i18n } from './config/i18n.config';
import colors from './src/styles/colors.module';
const isBuildProd = process.env.NODE_ENV === 'production';
const isProduction = process.env.NUXT_ENV_STAGE === 'production';
const isSsr = process.env.NUXT_ENV_MODE === 'universal';
const config: NuxtConfig = {
ssr: isSsr,
target: 'static',
modern: isProduction,
srcDir: './src',
...head,
build,
components: false,
modules,
i18n,
typedRouter: {
filePath: 'src/models/__routes.ts',
},
loading: {
color: colors.red,
failedColor: colors.white,
height: '4px',
},
tailwindcss: {
cssPath: '~/styles/tailwind.css',
configPath: '~~/tailwind.config.cjs',
viewer: false,
},
server: {
port: process.env.NUXT_ENV_PORT,
host: '0.0.0.0',
},
plugins: [
{ src: '~/plugins/global.plugin.ts' },
{ src: '~/plugins/mounted.plugin.ts', ssr: false },
{ src: '~/plugins/constants.plugin.ts' },
{ src: '~/plugins/toasts.plugin.ts' },
{ src: '~/plugins/i18n.plugin.ts' },
{ src: '~/plugins/nuxt-typed-router.plugin.ts' },
{ src: '~/plugins/serviceworker.plugin.ts', ssr: false },
],
router: {
middleware: ['router.middleware'],
},
css: ['~/styles/root.css'],
buildModules: [
'@nuxt/typescript-build',
'@nuxt/postcss8',
'@nuxtjs/tailwindcss',
'@nuxtjs/pwa',
'@nuxtjs/composition-api/module',
'@nuxtjs/google-analytics',
],
googleAnalytics: {
id: 'UA-57021034-1',
},
render: {
static: {
setHeaders(res) {
res.setHeader('Cache-Control', 'must-revalidate, public, max-age=3153600');
},
},
bundleRenderer: {
shouldPreload: (file, type) => {
return ['script', 'style', 'font'].includes(type);
},
},
},
};
export default config;