forked from vinu-deriv/trading-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
93 lines (91 loc) · 2.33 KB
/
vite.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
import { VitePWA } from "vite-plugin-pwa";
import { defineConfig } from "vite";
import { dependencies } from "./package.json";
import path from "path";
import solidPlugin from "vite-plugin-solid";
import solidSvg from "vite-plugin-solid-svg";
function renderChunks(deps) {
const chunks = {};
Object.keys(deps).forEach((key) => {
if (["@deriv/deriv-api", "solid-js", "@solidjs/router"].includes(key))
return;
chunks[key] = [key];
});
return chunks;
}
export default defineConfig({
plugins: [
solidPlugin(),
solidSvg({
defaultAsComponent: true,
svgo: {
enabled: true,
},
}),
VitePWA({
base: "/",
strategies: "injectManifest",
registerType: "autoUpdate",
includeAssets: ["offline.html"],
injectManifest: {
globPatterns: ["**/*.{css,html,js,png}"],
},
manifest: {
name: "Trading App",
short_name: "TradingApp",
description: "My Awesome App description",
theme_color: "#000000",
icons: [
{
src: "icon-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "maskable",
},
{
src: "icon-144x144.png",
sizes: "144x144",
type: "image/png",
purpose: "any",
},
{
src: "icon-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
devOptions: {
enabled: true,
/* other options */
},
}),
],
server: {
port: 3003,
},
build: {
target: "esnext",
rollupOptions: {
output: {
manualChunks: {
vendor: ["@deriv/deriv-api", "solid-js", "@solidjs/router"],
...renderChunks(dependencies),
},
},
},
},
resolve: {
alias: {
Assets: path.resolve(__dirname, "./src/assets"),
Components: path.resolve(__dirname, "./src/components"),
Constants: path.resolve(__dirname, "./src/constants"),
Containers: path.resolve(__dirname, "./src/containers"),
Routes: path.resolve(__dirname, "./src/routes"),
Stores: path.resolve(__dirname, "./src/stores"),
Styles: path.resolve(__dirname, "./src/styles"),
Utils: path.resolve(__dirname, "./src/utils"),
},
},
});