From 232b3ae1c3a02b4ad666f306f38ee47211bae164 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Fri, 11 Jun 2021 15:21:42 -0500 Subject: [PATCH] Add isNetlify env helper --- helpers/environment.js | 2 ++ helpers/incremental/caching.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/helpers/environment.js b/helpers/environment.js index c9a3f0d..40a210f 100644 --- a/helpers/environment.js +++ b/helpers/environment.js @@ -4,4 +4,6 @@ import path from 'path' export const isProduction = process.env.NODE_ENV === 'PRODUCTION' +export const isNetlify = process.env.NETLIFY === true + export const rootDir = path.resolve(__dirname, '../') diff --git a/helpers/incremental/caching.js b/helpers/incremental/caching.js index cee03de..24bd3a7 100644 --- a/helpers/incremental/caching.js +++ b/helpers/incremental/caching.js @@ -4,12 +4,12 @@ import { default as TOML } from '@iarna/toml' // https://github.com/jprichardson/node-fs-extra import fs from 'fs-extra' -import { isProduction, rootDir } from '../environment.js' +import { isNetlify, rootDir } from '../environment.js' // https://github.com/hanbyul-here/nuxt-incremental-build-exp/blob/cb3ef6b001b283de77efee64733db273d991129b/cache-me.js -export const CACHE_PATH = isProduction +export const CACHE_PATH = isNetlify ? path.join('/', 'opt', 'build', 'cache', 'app_build') // Netlify cache path : path.join(rootDir, '.app_build_cache')//path.resolve(__dirname, '.app_build_cache')