Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

chore(build): improve build process and memory management (#264)

Timothy Yinbb0b73056107
diff --git a/nuxt.config.ts b/nuxt.config.ts
index ad40944f..af984501 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -1,5 +1,4 @@
import pkg from './package.json'
-import tailwindcss from '@tailwindcss/vite'
import type { AnalyticsConfig } from './shared/types/config'
// https://nuxt.com/docs/api/configuration/nuxt-config
@@ -139,7 +138,6 @@ export default defineNuxtConfig({
},
vite: {
- plugins: [tailwindcss() as any],
optimizeDeps: {
include: [
'zod',
@@ -178,11 +176,53 @@ export default defineNuxtConfig({
},
build: {
sourcemap: false,
+ rollupOptions: {
+ output: {
+ manualChunks(id) {
+ if (!id.includes('node_modules')) {
+ return
+ }
+
+ if (
+ id.includes('/mapbox-gl/') ||
+ id.includes('/maplibre-gl/') ||
+ id.includes('/@indoorequal/vue-maplibre-gl/') ||
+ id.includes('/nuxt-mapbox/') ||
+ id.includes('/nuxt-maplibre/')
+ ) {
+ return 'vendor-map'
+ }
+ },
+ },
+ },
commonjsOptions: {
include: [/maplibre-gl/, /node_modules/],
transformMixedEsModules: true,
},
},
+ plugins: [
+ {
+ apply: 'build',
+ name: 'vite-plugin-ignore-sourcemap-warnings',
+ configResolved(config) {
+ const originalOnWarn = config.build.rollupOptions.onwarn
+ config.build.rollupOptions.onwarn = (warning, warn) => {
+ if (
+ warning.code === 'SOURCEMAP_BROKEN' &&
+ warning.plugin === '@tailwindcss/vite:generate:build'
+ ) {
+ return
+ }
+
+ if (originalOnWarn) {
+ originalOnWarn(warning, warn)
+ } else {
+ warn(warning)
+ }
+ }
+ },
+ },
+ ],
},
gtag: {
diff --git a/package.json b/package.json
index d232a44d..d239cdfc 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"db:drop": "drizzle-kit drop",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
- "build": "nuxt build",
+ "build": "NODE_OPTIONS=\"--max-old-space-size=8192\" nuxt build",
"build:deps": "pnpm --filter @chronoframe/webgl-image build",
"dev": "run-p dev:dep dev:wait-only",
"dev:dep": "pnpm --filter @chronoframe/webgl-image dev",
@@ -124,4 +124,4 @@
"sharp"
]
}
-}
+}
\ No newline at end of file