-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathnuxt.config.ts
148 lines (139 loc) · 3.19 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
import { defineNuxtConfig } from "nuxt/config"
// import svgLoader from "vite-svg-loader"
import { pwa } from "./src/config/pwa"
import { appDescription } from "./src/constants"
function getGitCommitDateYMD() {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { execSync } = require("child_process")
const date = execSync("git show -s --format=%ci HEAD").toString()
return date.slice(0, 10).replaceAll("-", "")
}
console.log(process.env.NUXT_ELECTRON)
export default defineNuxtConfig({
srcDir: "src/",
postcss: {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
},
build: {},
css: ["~/assets/scss/index.scss"],
runtimeConfig: {
public: {
LATEST_COMMIT_DATE: getGitCommitDateYMD(),
API_BASE_URL: process.env.NUXT_API_BASE_URL || "/api",
},
},
modules: [
"@nuxtjs/i18n",
"@nuxtjs/device",
"nuxt-icon",
"@vueuse/nuxt",
"@pinia/nuxt",
"@nuxtjs/color-mode",
"@vite-pwa/nuxt",
"@nuxt/ui",
].concat(process.env.NUXT_ELECTRON ? ["nuxt-electron"] : []),
ui: {
icons: ["mdi", "lucide"],
},
electron: {
build: [
{
// Main-Process entry file of the Electron App.
entry: "electron/main.ts",
vite: {
build: {
lib: {
entry: "electron/main.ts",
formats: ["cjs"],
},
outDir: "dist-electron",
},
},
},
{
entry: "electron/preload.ts",
vite: {
build: {
lib: {
entry: "electron/preload.ts",
formats: ["cjs"],
},
outDir: "dist-electron",
},
},
onstart(options) {
// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
// instead of restarting the entire Electron App.
options.reload()
},
},
],
renderer: {},
},
experimental: {
appManifest: false,
},
colorMode: {
classSuffix: "",
},
nitro: {
esbuild: {
options: {
target: "esnext",
},
},
},
app: {
head: {
viewport: "width=device-width,initial-scale=1,user-scalable=no",
link: [
{
rel: "icon",
href: "/favicon.ico",
sizes: "any",
},
{
rel: "icon",
type: "image/svg+xml",
href: "/nuxt.svg",
},
{
rel: "apple-touch-icon",
href: "/apple-touch-icon.png",
},
// {
// rel: "stylesheet",
// href: "https://rsms.me/inter/inter.css",
// },
],
script: [],
meta: [
{
name: "viewport",
content: "width=device-width, initial-scale=1",
},
{
name: "description",
content: appDescription,
},
{
name: "apple-mobile-web-app-status-bar-style",
content: "black-translucent",
},
],
},
},
i18n: {
locales: ["en", "zh_CN"],
defaultLocale: "en",
strategy: "no_prefix",
vueI18n: "./i18n.config.ts", // if you are using custom path, default
},
pwa,
devtools: {
enabled: true,
},
})