@@ -6,14 +6,22 @@ import ReactComponentName from 'react-scan/react-component-name/webpack';
66
77const isProd = process . env . NODE_ENV === 'production' ;
88const buildWithDocker = process . env . DOCKER === 'true' ;
9+ const isDesktop = process . env . NEXT_PUBLIC_IS_DESKTOP_APP === '1' ;
910const enableReactScan = ! ! process . env . REACT_SCAN_MONITOR_API_KEY ;
1011const isUsePglite = process . env . NEXT_PUBLIC_CLIENT_DB === 'pglite' ;
1112
1213// if you need to proxy the api endpoint to remote server
1314
1415const basePath = process . env . NEXT_PUBLIC_BASE_PATH ;
16+ const isStandaloneMode = buildWithDocker || isDesktop ;
17+
18+ const standaloneConfig : NextConfig = {
19+ output : 'standalone' ,
20+ outputFileTracingIncludes : { '*' : [ 'public/**/*' , '.next/static/**/*' ] } ,
21+ } ;
1522
1623const nextConfig : NextConfig = {
24+ ...( isStandaloneMode ? standaloneConfig : { } ) ,
1725 basePath,
1826 compress : isProd ,
1927 experimental : {
@@ -110,10 +118,6 @@ const nextConfig: NextConfig = {
110118 hmrRefreshes : true ,
111119 } ,
112120 } ,
113- output : buildWithDocker ? 'standalone' : undefined ,
114- outputFileTracingIncludes : buildWithDocker
115- ? { '*' : [ 'public/**/*' , '.next/static/**/*' ] }
116- : undefined ,
117121 reactStrictMode : true ,
118122 redirects : async ( ) => [
119123 {
@@ -231,13 +235,14 @@ const noWrapper = (config: NextConfig) => config;
231235
232236const withBundleAnalyzer = process . env . ANALYZE === 'true' ? analyzer ( ) : noWrapper ;
233237
234- const withPWA = isProd
235- ? withSerwistInit ( {
236- register : false ,
237- swDest : 'public/sw.js' ,
238- swSrc : 'src/app/sw.ts' ,
239- } )
240- : noWrapper ;
238+ const withPWA =
239+ isProd && ! isDesktop
240+ ? withSerwistInit ( {
241+ register : false ,
242+ swDest : 'public/sw.js' ,
243+ swSrc : 'src/app/sw.ts' ,
244+ } )
245+ : noWrapper ;
241246
242247const hasSentry = ! ! process . env . NEXT_PUBLIC_SENTRY_DSN ;
243248const withSentry =
0 commit comments