Fix env not working in vite config

So the manifest can't even get the name 🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️🤦‍♂️
This commit is contained in:
Lim Chee Aun 2022-12-22 19:38:02 +08:00
parent a1fef8fd1d
commit 11c5b02832

View file

@ -1,10 +1,13 @@
import preact from '@preact/preset-vite';
import { execSync } from 'child_process';
import { resolve } from 'path';
import { defineConfig, splitVendorChunkPlugin } from 'vite';
import { defineConfig, loadEnv, splitVendorChunkPlugin } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
const { VITE_CLIENT_NAME: CLIENT_NAME, NODE_ENV } = process.env;
const { VITE_CLIENT_NAME: CLIENT_NAME, NODE_ENV } = loadEnv(
'production',
process.cwd(),
);
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();