forked from sunflower-land/sunflower-land
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
117 lines (116 loc) · 2.94 KB
/
vite.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
import { defineConfig } from "vite";
import reactRefresh from "@vitejs/plugin-react-refresh";
import tsconfigPaths from "vite-tsconfig-paths";
import { minifyHtml, injectHtml } from "vite-plugin-html";
import { VitePWA } from "vite-plugin-pwa";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
reactRefresh(),
tsconfigPaths(),
minifyHtml(),
injectHtml({
// TODO with API environment variables
injectData: {},
}),
VitePWA({
devOptions: {
enabled: true,
type: "module",
navigateFallback: "offline.html",
},
srcDir: "src",
strategies: "injectManifest",
includeManifestIcons: false,
includeAssets: [
"world/*",
"pwa/**/*",
"farms/*",
"offline/*",
"offline.html",
],
injectManifest: {
maximumFileSizeToCacheInBytes: 15000000,
globPatterns: ["assets/*.{jpg,mp3,svg,gif,png}"],
globIgnores: ["**/*.{js,css,html}"],
},
filename: "sw.ts",
manifest: {
name: "Sunflower Land",
id: "com.sunflower-land",
description:
"🧑🌾 Install our app for a more seamless farming experience. Enjoy full-screen action, easy access, and exclusive features!",
short_name: "Sunflower Land",
start_url:
process.env.VITE_NETWORK === "mainnet" ? "/play/" : "/testnet/",
theme_color: "#303443",
display: "standalone",
background_color: "#0099dc",
orientation: "portrait",
icons: [
{
src: "pwa/icons/pwa-64x64.png",
sizes: "64x64",
type: "image/png",
purpose: "any",
},
{
src: "pwa/icons/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "pwa/icons/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
},
{
src: "pwa/icons/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
screenshots: [
{
src: "pwa/screenshots/1.jpg",
sizes: "900x1680",
type: "image/jpg",
form_factor: "narrow",
},
{
src: "pwa/screenshots/2.jpg",
sizes: "900x1680",
type: "image/jpg",
form_factor: "narrow",
},
],
},
}),
],
// Addresses web3 issue
resolve: {
alias: {
web3: "web3/dist/web3.min.js",
process: "process/browser",
stream: "stream-browserify",
zlib: "browserify-zlib",
util: "util",
},
},
css: {
modules: {},
},
base: "./",
build: {
chunkSizeWarningLimit: 1000,
assetsDir: "assets",
rollupOptions: {
output: {
manualChunks: {
phaser: ["phaser"],
},
},
},
},
});