-
Notifications
You must be signed in to change notification settings - Fork 355
/
nuxt.config.ts
369 lines (350 loc) · 9.55 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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
import { NuxtConfig } from "@nuxt/types";
import { NuxtOptionsBuild } from "@nuxt/types/config/build";
import { NuxtOptionsEnv } from "@nuxt/types/config/env";
import { version as zkSyncVersion } from "zksync/package.json";
import { ModuleOptions } from "@matterlabs/zksync-nuxt-core/types";
import { Configuration } from "webpack";
// @ts-ignore
import packageData from "./package.json";
const gitVersion = packageData.version;
const appEnv: string = process.env.APP_ENV ?? "dev";
const isLocalhost: boolean = !!process.env.IS_LOCALHOST;
const isDebugEnabled: boolean = appEnv === "dev";
const isProduction: boolean = appEnv === "prod";
const gitRevision =
`${process.env.APP_GIT_REVISION}`.length > 8
? `${process.env.APP_GIT_REVISION}`.slice(0, 7)
: `${process.env.APP_GIT_REVISION}`;
const meta = {
title: "zkSync Lite Wallet",
titleTemplate: "%s | zkSync Lite: secure, scalable crypto payments",
description:
"A crypto wallet & gateway to layer-2 zkSync Rollup. zkSync Lite is a trustless, secure, user-centric protocol for scaling payments and smart contracts on Ethereum",
keywords:
"zkSync Lite, rollup, ZK rollup, zero confirmation, ZKP, zero-knowledge proofs, Ethereum, crypto, blockchain, permissionless, L2, secure payments, scalable crypto payments, zkWallet",
image: "/social.png",
};
const functionsBaseUrl = process.env.FIREBASE_FUNCTIONS_BASE_URL || "http://localhost:5001/zksync-vue/us-central1/";
const config = <NuxtConfig>{
components: ["@/components/", { path: "@/blocks/", prefix: "block" }],
telemetry: false,
ssr: false,
target: "static",
srcDir: "./src/",
vue: {
config: {
productionTip: isProduction,
devtools: !isProduction,
},
},
env: {
...process.env,
} as NuxtOptionsEnv,
publicRuntimeConfig: {
mixpanel: {
isProduction,
token: `${process.env.MIXPANEL_TOKEN}`,
},
git: {
version: gitVersion,
revision: gitRevision,
},
zksyncVersion: zkSyncVersion,
},
head: {
title: meta.title,
titleTemplate: meta.titleTemplate,
htmlAttrs: {
lang: "en",
amp: "true",
},
meta: [
{
httpEquiv: "cache-control",
property: "cache-control",
content: "no-cache , no-store, must-revalidate",
},
{
httpEquiv: "expires",
content: "0",
property: "expires",
},
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0" },
/**
* Page meta:
* - SEO tags (keywords, description, author)
* - OpenGraph tags (thumbnail,
**/
{
hid: "keywords",
name: "keywords",
content: meta.keywords,
},
{
hid: "description",
name: "description",
content: meta.description,
},
{
hid: "author",
name: "author",
content: "https://matter-labs.io",
},
{
hid: "twitter:title",
name: "twitter:title",
content: meta.title,
},
{
hid: "twitter:description",
name: "twitter:description",
content: meta.description,
},
{
hid: "twitter:image",
name: "twitter:image",
content: meta.image,
},
{
hid: "twitter:site",
name: "twitter:site",
content: "@zksync",
},
{
hid: "twitter:creator",
name: "twitter:creator",
content: "@the_matter_labs",
},
{
hid: "twitter:image:alt",
name: "twitter:image:alt",
content: meta.title,
},
{
hid: "og:title",
property: "og:title",
content: meta.title,
},
{
hid: "og:description",
property: "og:description",
content: meta.description,
},
{
hid: "og:image",
property: "og:image",
content: meta.image,
},
{
hid: "og:image:secure_url",
property: "og:image:secure_url",
content: meta.image,
},
{
hid: "og:image:alt",
property: "og:image:alt",
content: meta.title,
},
{
hid: "msapplication-TileImage",
name: "msapplication-TileImage",
content: "/favicon.png",
},
{ hid: "theme-color", name: "theme-color", content: "#4e529a" },
{
hid: "msapplication-TileColor",
property: "msapplication-TileColor",
content: "#4e529a",
},
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.png" }],
},
// Customize the progress-bar color
loading: {
color: "#8c8dfc",
continuous: true,
},
// Single-entry global-scope scss
css: ["@/assets/style/main.scss"],
// Plugins that should be loaded before the mounting
plugins: [
"@/plugins/icons",
"@/plugins/routerMixin",
"@/plugins/filters",
"@/plugins/restoreSession",
{ src: "@/plugins/analytics", mode: "client" },
],
styleResources: {
scss: ["@/assets/style/vars/*.scss"],
},
router: {
middleware: ["auth"],
},
// Nuxt.js dev-modules
buildModules: [
// https://go.nuxtjs.dev/typescript
"@nuxt/typescript-build",
"@nuxtjs/style-resources",
"@nuxtjs/google-fonts",
"nuxt-typed-vuex",
[
"@matterlabs/zksync-nuxt-core",
<ModuleOptions>{
ipfsGateway: "https://ipfs.io",
network: process.env.ZK_NETWORK,
apiKeys: {
FORTMATIC_KEY: process.env.APP_FORTMATIC,
PORTIS_KEY: process.env.APP_PORTIS,
INFURA_KEY: "560464419d33486ab1713d61ac9f1d82",
},
onboardConfig: {
APP_NAME: meta.title,
APP_ID: "764666de-bcb7-48a6-91fc-75e9dc086ea0",
},
disabledWallets: [
{
name: "Keystone",
error: `Wallet Keystone is not supported`,
},
],
restoreNetwork: true,
logoutRedirect: "/",
screeningApiUrl: process.env.SCREENING_API_URL,
},
],
],
// Nuxt.js modules
modules: ["@inkline/nuxt", "@nuxtjs/sentry", "@nuxtjs/proxy", "@nuxtjs/google-gtag"],
inkline: {
config: {
autodetectVariant: true,
},
},
sentry: {
dsn: "https://de3e0dcf0e9c4243b6bd7cfbc34f6ea1@o496053.ingest.sentry.io/5569800",
disableServerSide: true,
disabled: isLocalhost,
config: {
tunnel: "/tunnel/sentry",
debug: isDebugEnabled,
tracesSampleRate: 1.0,
environment: isProduction ? "production" : appEnv === "dev" ? "development" : appEnv,
},
},
proxy: isLocalhost
? {
"/api/moonpaySign": `${functionsBaseUrl}moonpaySign`,
"/tunnel/mixpanel": `${functionsBaseUrl}mixpanelTunnel`,
"/tunnel/sentry": `${functionsBaseUrl}sentryTunnel`,
}
: {},
"google-gtag": {
id: "GTM-ML2QDNV",
config: {
anonymize_ip: true, // anonymize IP
send_page_view: false, // might be necessary to avoid duplicated page track on page reload
linker: {
domains: ["lite.zksync.io"],
},
},
debug: isDebugEnabled, // enable to track in dev mode
disableAutoPageTrack: false, // disable if you don't want to track each page route with router.afterEach(...).
},
render: {
injectScripts: true,
ssr: false,
crossorigin: "anonymous",
resourceHints: false,
static: {
immutable: true,
maxAge: "1d",
prefix: true,
},
dist: {
lastModified: true,
immutable: true,
// Serve index.html template
index: true,
maxAge: "1m",
},
},
// Build configuration
build: <NuxtOptionsBuild>{
filenames: { chunk: () => `[name]_Y2ZjItY_${isProduction ? "[contenthash]" : ""}.js` },
cache: isProduction,
cssSourceMap: !isProduction,
hardSource: isProduction,
parallel: isProduction,
babel: {
compact: true,
plugins: ["@babel/plugin-proposal-optional-chaining", "@babel/plugin-proposal-nullish-coalescing-operator"],
},
postcss: {
plugins: {
autoprefixer: {},
},
},
corejs: 3,
ssr: false,
extractCSS: {
ignoreOrder: true,
},
optimization: {
removeAvailableModules: true,
flagIncludedChunks: true,
mergeDuplicateChunks: true,
splitChunks: {
chunks: "async",
maxSize: 200000,
},
minimize: isProduction,
},
transpile: ["oh-vue-icons", "@inkline/inkline", "iconsPlugin", "filtersPlugin", "restoreSessionPlugin"],
extend: (config: Configuration) => {
config.module!.rules.push({
test: /\.m?js$/,
include: [
/node_modules[\\/]superstruct/,
/node_modules[\\/]@walletconnect/,
/node_modules[\\/]@web3modal[\\/]core/,
/node_modules[\\/]@web3modal[\\/]ui/,
],
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-proposal-optional-chaining", "@babel/plugin-proposal-nullish-coalescing-operator"],
},
},
});
config.node = {
fs: "empty",
};
if (!config.output) {
config.output = {
crossOriginLoading: isProduction ? "anonymous" : false,
};
} else {
config.output.crossOriginLoading = isProduction ? "anonymous" : false;
}
},
},
googleFonts: {
overwriting: true,
prefetch: true,
preconnect: true,
preload: true,
display: "swap",
families: {
"Fira+Sans": [400, 600],
"Fira+Code": [400],
},
},
generate: {
dir: "public",
cache: false,
devtools: !isProduction,
},
};
export default config;