diff --git a/next.config.mjs b/next.config.mjs index d86752cda7..c3d20d2d50 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -12,6 +12,8 @@ const isProd = process.env.NODE_ENV === 'production' /** @type {import('next').NextConfig} */ // eslint-disable-next-line import/no-mutable-exports let nextConfig = { + output: 'standalone', + assetPrefix: isProd ? env.ASSETPREFIX || undefined : undefined, compiler: { // reactRemoveProperties: { properties: ['^data-id$', '^data-(\\w+)-id$'] }, }, diff --git a/package.json b/package.json index 412af8f6d9..101b42081f 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "build:ci": "cross-env NODE_ENV=production CI=true next build", "lint": "eslint --ext .ts,.tsx --ignore-path .gitignore . --fix", "prod:pm2": "cross-env NODE_ENV=production pm2 restart ecosystem.config.js", - "prod:pm2-alone": "cross-env NODE_ENV=production pm2 restart ecosystem.standalone.config.js", "prod:stop": "pm2 stop ecosystem.config.js", "prod:reload": "pm2 reload ecosystem.config.js" }, diff --git a/src/lib/request.ts b/src/lib/request.ts index 7c6421b688..fb1f9900c9 100644 --- a/src/lib/request.ts +++ b/src/lib/request.ts @@ -28,7 +28,7 @@ export const apiClient = createClient(axiosAdaptor)(API_URL, { export const $axios = axiosAdaptor.default as AxiosInstance -$axios.defaults.timeout = 10000 +$axios.defaults.timeout = 3000 if (typeof window === 'undefined') $axios.defaults.headers.common[ diff --git a/standalone-build.sh b/standalone-build.sh new file mode 100644 index 0000000000..f67d4636ca --- /dev/null +++ b/standalone-build.sh @@ -0,0 +1,23 @@ +#!env bash +set -e +CWD=$(pwd) +npm run build +cd .next +pwd +rm -rf cache +cp ../next.config.mjs ./standalone/next.config.mjs +cp -r ../public ./standalone/public + +cd ./standalone +echo ';process.title = "Shiro (NextJS)"' >>server.js +mv ../static/ ./.next/static + +# move workbox +# cp ../sw.js ./public/sw.js +# cp ../workbox-*.js ./public + +cp $CWD/ecosystem.config.js ./ecosystem.config.js + +cd .. + +zip --symlinks -r $CWD/release.zip ./*