-
Notifications
You must be signed in to change notification settings - Fork 48
/
nuxt.config.js
225 lines (200 loc) · 5.65 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
'use strict';
const isProduction = process.env.NODE_ENV === 'production';
const editorMode = process.env.SWELL_EDITOR === 'true';
const storeId = process.env.SWELL_STORE_ID;
const publicKey = process.env.SWELL_PUBLIC_KEY;
const storeUrl = process.env.SWELL_STORE_URL;
const vaultUrl = process.env.SWELL_VAULT_URL;
export default () => {
return {
target: editorMode ? 'server' : 'static',
build: {
analyze: !isProduction,
hotMiddleware: {
client: {
// Turn off client overlay when errors are present
overlay: false,
},
},
},
vue: {
config: {
devtools: !isProduction,
productionTip: false,
},
},
/*
** Make all components in the /components folder available in templates without
* needing to import them explicitly or define them on the Vue instance object.
*/
components: true,
/*
** Set the progress-bar color
*/
loading: {
// color: Set by the swell module.
continuous: true,
},
/*
** Vue plugins to load before mounting the App
*/
plugins: [
{ src: '~/plugins/global-scripts', mode: 'client' },
{ src: '~/plugins/vue-credit-card-validation', mode: 'client' },
{ src: '~/plugins/directives', mode: 'client' },
{ src: '~/plugins/swell-lang.js' },
{ src: '~/plugins/filters.js' },
],
/*
** Nuxt.js modules
*/
modules: [
['@nuxtjs/gtm'],
// [
// '@nuxtjs/sentry',
// /*
// ** Logs app errors with Sentry's browser and node SDKs.
// *
// * You can use environment variables or the object below to set config options.
// * See https://github.com/nuxt-community/sentry-module for all available
// * options, defaults, and environment variables.
// */
// {
// // dsn: '', // or SENTRY_DSN in .env
// // config: {}
// },
// ],
/*
** Generates a sitemap.xml
*
* Automatically generate or serve dynamic sitemap.xml for Nuxt projects!
* See https://github.com/nuxt-community/sentry-module for all available
* options, defaults, and environment variables.
*/
'@nuxtjs/sitemap',
],
buildModules: [
// https://go.nuxtjs.dev/eslint
'@nuxtjs/eslint-module',
// https://go.nuxtjs.dev/stylelint
'@nuxtjs/stylelint-module',
[
// https://go.nuxtjs.dev/tailwindcss
'@nuxtjs/tailwindcss',
/*
** Adds TailwindCSS (including PurgeCSS)
*
* See https://tailwindcss.nuxtjs.org/ for config options.
*/
{
// Put your config overrides here
},
],
[
'~/modules/swell',
/*
** Initializes Swell.js SDK and injects it into Nuxt's context.
* It also sets additional plugins and module settings for
* full integration (e.g. i18n settings, styling, etc...)
*/
],
[
'~/modules/swell-editor',
/*
** Provides communication and utilitiy functions for interfacing
* with Swell's storefront editor and fetching settings/content.
*/
],
['@nuxtjs/i18n'],
[
'@nuxtjs/google-fonts',
/*
** Parses Google Font families and loads them via stylesheet.
*
* The config object is generated by the swell-editor module.
* See https://github.com/nuxt-community/google-fonts-module if you want
* to eject or provide your own config options.
*/
// Options set by the swell module
],
[
'@nuxtjs/pwa',
/*
** Provides PWA (Progressive Web App) functionality including app icons,
* SEO metadata, manifest.json file, and offline caching.
*
* Use the object below to set config options.
* See https://pwa.nuxtjs.org/ for all available options and defaults.
*/
],
],
swell: {
storeId,
publicKey,
storeUrl,
vaultUrl,
editorMode,
},
gtm: {
// Set by the swell module
},
pwa: {
manifest: false,
meta: {
// name: Set by the swell module
},
workbox: {
runtimeCaching: [
{
urlPattern:
`${process.env.CDN_HOST}/*` || 'https://cdn.schema.io/*',
},
],
},
},
i18n: {
// Set by the swell module
},
sitemap: {
// hostname: Set by the swell module
gzip: true,
i18n: true,
exclude: ['/account/**', '/*/account/**'],
},
generate: {
exclude: [/^\/?([a-z]{2}-?[A-Z]{2}?)?\/account/],
fallback: true, // Fallback to the generated 404.html,
concurrency: 1,
interval: 50,
crawler: false,
// routes: Set by the swell module
},
/*
** Extend default Nuxt routes to add page aliases
*/
router: {
middleware: ['currency'],
trailingSlash: true,
extendRoutes(routes, resolve) {
// Rewrite to use the pages/_slug.vue component for home page, since the
// content type is the same. If you want to have a unique template,
// create a pages/index.vue and remove this route definition.
routes.push({
name: 'index',
path: '/',
component: resolve(__dirname, 'pages/_slug.vue'),
});
},
},
/*
** Extend default Nuxt server options
*/
server: {
host: process.env.HOST || 'localhost',
port: process.env.PORT || 3333,
},
env: {
cdnHost: process.env.CDN_HOST || 'https://cdn.schema.io',
},
};
};