-
Notifications
You must be signed in to change notification settings - Fork 3
/
nuxt.config.js
225 lines (205 loc) · 6.02 KB
/
nuxt.config.js
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
require("dotenv").config()
export default {
target: "static",
env: {
...process.env,
},
/*
** Headers of the page
*/
head: {
meta: [
{ charset: "utf-8" },
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.png" }]
},
/*
** Default transition for all pages
*/
pageTransition: {
name: "fade",
mode: "out-in",
},
/*
** Customize the progress-bar color
** See: https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-loading
*/
loading: {
color: "#000000",
height: "3px",
},
/*
** Global CSS
*/
css: [
"~/styles/css-variables.scss",
"~/styles/global.scss",
"~/styles/transitions.scss",
//"~/styles/fonts.css" // Be sure to turn on the font loader plugin and config it
],
/*
** Load SCSS into each component
*/
styleResources: {
scss: ["~/styles/scss-variables.scss"],
},
/*
** Plugins to load before mounting the App
*/
plugins: [
{ src: "~/plugins/global-component-loader.js" },
{ src: "~/plugins/global-directive-loader.js" },
{ src: "~/plugins/google-gtag.client.js", mode: "client" },
{ src: "~plugins/preview.client.js", mode: "client" },
//{ src: "~/plugins/web-font-loader.client.js", mode: "client" },
//{ src: "~/plugins/ip-geolocate.js" },
],
/*
** Nuxt.js modules
*/
modules: [
"@nuxtjs/style-resources",
"@nuxtjs/sitemap",
// [
// "nuxt-vuex-localstorage",
// {
// localStorage: ["geolocation"],
// mode: "debug",
// },
// ],
],
/*
* Build modules
*/
buildModules: [
"@nuxtjs/dotenv",
"nuxt-graphql-request",
"~/modules/sitemap-route-generator",
],
/*
** GraphQL Request options.
** See: https://github.com/Gomah/nuxt-graphql-request
*/
graphql: {
endpoint: process.env.GQL_ENDPOINT,
options: {
credentials: "include",
mode: "cors",
},
},
/*
** Customize router
*/
router: {
linkExactActiveClass: "exact-active-link",
linkActiveClass: "active-link",
middleware: ["referrer"],
prefetchLinks: true,
linkPrefetchedClass: "link-prefetched",
trailingSlash: true,
},
/*
** Server side middleware
*/
serverMiddleware: ["~/middleware/redirect-trailing-slash.server.js"],
/*
** Build configuration
*/
build: {
// This and the transpile code below fix an issue with the spread operator in Safari 10.
babel: {
plugins: ["@babel/plugin-proposal-object-rest-spread"],
},
transpile: ["ky", "vuex"],
extend(config, ctx) {
// Includes the Compiler version of Vue.
// If you don't use the <wp-content> component, then you can delete this safely.
config.resolve.alias["vue$"] = "vue/dist/vue.esm.js"
// This stops a @nuxtjs/dotenv error.
config.node = { fs: "empty" }
// Remove SVG from default Nuxt webpack rules
const svgRule = config.module.rules.find((rule) =>
rule.test.test(".svg")
)
svgRule.test = /\.(png|jpe?g|gif|webp)$/i
// Use SVG loader for .svg files
config.resolve.extensions.push(".svg")
config.module.rules.push({
test: /\.svg$/,
use: [
"babel-loader",
{
loader: "vue-svg-loader",
options: {
svgo: {
plugins: [{ removeViewBox: false }],
},
},
},
],
})
},
html: {
// These settings make Netlify build times much faster.
// SEE https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-build#htmlminify
minify: {
collapseBooleanAttributes: true,
decodeEntities: true,
minifyCSS: false,
minifyJS: false,
processConditionalComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: true,
trimCustomFragments: true,
useShortDoctype: true,
},
},
},
/*
** Nuxt generate configuration. Used when generating a static site.
*/
generate: {
fallback: "404.html",
interval: 500,
concurrency: 100,
},
/*
** Setup for the Sitemap module.
** You can see output at /sitemap.xml
** SEE https://github.com/nuxt-community/sitemap-module
*/
sitemap: {
// If you are NOT using Netlify to host, you need to set the hostname
hostname: process.env.URL || "http://localhost:3000",
filter({ routes }) {
// Don't allow these paths to show in sitemap.
// Add anything you want to hide from the sitemap
const excludedPaths = ["/wp-admin/"]
return routes.filter((route) => {
return !excludedPaths.includes(route.url)
})
},
},
/*
** Allow devices on local network to view the site at {your IP}:3000
*/
server: {
host: process.env.HOST || "0.0.0.0",
},
/*
** Storybook
** SEE https://storybook.nuxtjs.org/options
*/
storybook: {
stories: ["~/stories/**/*.stories.js"],
webpackFinal(config, { configDir }) {
// Allow webpack to auto-load .gql and .svg files
config.resolve.extensions.push(".gql", ".svg")
return config
},
},
}