mirror of
https://github.com/AnimeThemes/animethemes-web.git
synced 2026-07-11 01:24:31 +02:00
feat: Added separate minimal build setting (#144)
This commit is contained in:
@@ -12,6 +12,7 @@ const SERVER_API_KEY = process.env.ANIMETHEMES_API_KEY;
|
||||
|
||||
const REVALIDATE_TOKEN = process.env.REVALIDATE_TOKEN;
|
||||
const ANALYZE = !!process.env.ANALYZE;
|
||||
const MINIMAL_BUILD = !!process.env.MINIMAL_BUILD;
|
||||
|
||||
// Server-side + Client-side
|
||||
|
||||
@@ -50,6 +51,7 @@ module.exports = {
|
||||
SERVER_API_KEY,
|
||||
REVALIDATE_TOKEN,
|
||||
ANALYZE,
|
||||
MINIMAL_BUILD,
|
||||
BASE_PATH,
|
||||
CLIENT_API_URL,
|
||||
VIDEO_URL,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { STAGING } from "utils/config";
|
||||
import { MINIMAL_BUILD } from "utils/config";
|
||||
import type { ParsedUrlQuery } from "querystring";
|
||||
|
||||
export default async function fetchStaticPaths<T extends ParsedUrlQuery = ParsedUrlQuery>(
|
||||
fetchPaths: () => Promise<Array<{ params: T }>>,
|
||||
allPathsInStaging = false
|
||||
forceFullBuild = false
|
||||
): Promise<{ paths: Array<{ params: T }>, fallback: "blocking" }> {
|
||||
// In development and staging all pages should be fetched on-demand. This speeds up page generation a lot.
|
||||
if (process.env.NODE_ENV === "development" || (STAGING && !allPathsInStaging)) {
|
||||
// In development all pages should be fetched on-demand. This speeds up page generation a lot.
|
||||
// This can also be enabled via an enviroment variable.
|
||||
if (process.env.NODE_ENV === "development" || (MINIMAL_BUILD && !forceFullBuild)) {
|
||||
return {
|
||||
paths: [],
|
||||
fallback: "blocking"
|
||||
|
||||
Reference in New Issue
Block a user