Fix NODE_ENV not even working here

This commit is contained in:
Lim Chee Aun 2023-01-02 14:22:01 +08:00
parent 07dff34e20
commit 89cb909094

View file

@ -7,11 +7,9 @@ import htmlPlugin from 'vite-plugin-html-config';
import VitePluginHtmlEnv from 'vite-plugin-html-env';
import { VitePWA } from 'vite-plugin-pwa';
const {
VITE_CLIENT_NAME: CLIENT_NAME,
NODE_ENV,
VITE_APP_ERROR_LOGGING,
} = loadEnv('production', process.cwd());
const { NODE_ENV } = process.env;
const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_APP_ERROR_LOGGING: ERROR_LOGGING } =
loadEnv('production', process.cwd());
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
@ -32,7 +30,7 @@ export default defineConfig({
splitVendorChunkPlugin(),
VitePluginHtmlEnv(),
htmlPlugin({
headScripts: VITE_APP_ERROR_LOGGING ? [rollbarCode] : [],
headScripts: ERROR_LOGGING ? [rollbarCode] : [],
}),
VitePWA({
manifest: {