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