-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnuxt.config.ts
executable file
·96 lines (84 loc) · 1.95 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
import { Configuration } from '@nuxt/types'
import pkg from './package.json'
const isDev = process.env.NODE_ENV !== 'production'
const apiBaseUrl = `${
isDev ? 'http://localhost:8000' : 'https://pokeapi.co'
}/api/v2`
const configuration: Configuration = {
mode: 'spa',
modern: true,
env: {
apiBaseUrl
},
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: pkg.description
}
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
{
rel: 'stylesheet',
href:
'https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap'
}
]
},
loading: { color: '#fff' },
buildModules: [
'@nuxt/typescript-build',
'@nuxtjs/stylelint-module',
'@nuxtjs/eslint-module',
'@nuxtjs/tailwindcss'
],
modules: [
'@nuxtjs/dotenv',
'@nuxtjs/axios',
'@nuxtjs/pwa' /* '@nuxtjs/proxy' */
],
plugins: ['~/plugins/api'],
pwa: {
workbox: {
// dev: true,
importScripts: ['/sw/custom.js'],
runtimeCaching: [
{
urlPattern: '.*/(_nuxt|file)/.*',
handler: 'staleWhileRevalidate'
}
]
},
meta: {
theme_color: '#F00000',
name: pkg.name,
description: pkg.description,
appleStatusBarStyle: 'black-translucent'
}
},
axios: {
baseUrl: apiBaseUrl
}
// proxy: {
// '/file/image': {
// pathRewrite: {
// '/file/image': '/'
// },
// target:
// 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon'
// },
// '/api': {
// pathRewrite: {
// '/api': '/api/v2'
// },
// target: isDev ? 'http://localhost:8000' : 'https://pokeapi.co',
// changeOrigin: true
// }
// }
}
export default configuration