mirror of
https://github.com/unraid/api.git
synced 2026-02-16 13:08:28 -06:00
fix: always mangle
This commit is contained in:
@@ -1,26 +1,25 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { parse } from 'dotenv';
|
||||
import { readFileSync } from "fs";
|
||||
import { parse } from "dotenv";
|
||||
import removeConsole from "vite-plugin-remove-console";
|
||||
|
||||
|
||||
const envConfig = parse(readFileSync('.env'));
|
||||
console.log('\n');
|
||||
console.log('==============================');
|
||||
console.log('========= ENV VALUES =========');
|
||||
console.log('==============================');
|
||||
const envConfig = parse(readFileSync(".env"));
|
||||
console.log("\n");
|
||||
console.log("==============================");
|
||||
console.log("========= ENV VALUES =========");
|
||||
console.log("==============================");
|
||||
for (const k in envConfig) {
|
||||
process.env[k] = envConfig[k];
|
||||
console.log(`[${k}]`, process.env[k]);
|
||||
}
|
||||
console.log('==============================');
|
||||
console.log('\n');
|
||||
console.log("==============================");
|
||||
console.log("\n");
|
||||
|
||||
/**
|
||||
* Used to avoid redeclaring variables in the webgui codebase.
|
||||
* @see alt solution https://github.com/terser/terser/issues/1001, https://github.com/terser/terser/pull/1038
|
||||
*/
|
||||
function terserReservations (inputStr: string) {
|
||||
const combinations = ['ace'];
|
||||
function terserReservations(inputStr: string) {
|
||||
const combinations = ["ace"];
|
||||
|
||||
// Add 1-character combinations
|
||||
for (let i = 0; i < inputStr.length; i++) {
|
||||
@@ -37,7 +36,8 @@ function terserReservations (inputStr: string) {
|
||||
return combinations;
|
||||
}
|
||||
|
||||
const charsToReserve = '_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
const charsToReserve =
|
||||
"_$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
@@ -49,12 +49,12 @@ export default defineNuxtConfig({
|
||||
enabled: true,
|
||||
},
|
||||
modules: [
|
||||
'@vueuse/nuxt',
|
||||
'@pinia/nuxt',
|
||||
'@nuxtjs/tailwindcss',
|
||||
'nuxt-custom-elements',
|
||||
"@vueuse/nuxt",
|
||||
"@pinia/nuxt",
|
||||
"@nuxtjs/tailwindcss",
|
||||
"nuxt-custom-elements",
|
||||
"@nuxt/eslint",
|
||||
'shadcn-nuxt',
|
||||
"shadcn-nuxt",
|
||||
],
|
||||
components: [
|
||||
{ path: "~/components/Brand", prefix: "Brand" },
|
||||
@@ -68,24 +68,23 @@ export default defineNuxtConfig({
|
||||
// typeCheck: true
|
||||
// },
|
||||
shadcn: {
|
||||
prefix: '',
|
||||
componentDir: './components/shadcn'
|
||||
prefix: "",
|
||||
componentDir: "./components/shadcn",
|
||||
},
|
||||
vite: {
|
||||
plugins: [
|
||||
!process.env.VITE_ALLOW_CONSOLE_LOGS && removeConsole({
|
||||
includes: ["log", "warn", "error", "info", "debug"],
|
||||
}),
|
||||
!process.env.VITE_ALLOW_CONSOLE_LOGS &&
|
||||
removeConsole({
|
||||
includes: ["log", "warn", "error", "info", "debug"],
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
minify: "terser",
|
||||
terserOptions: {
|
||||
mangle: process.env.VITE_ALLOW_CONSOLE_LOGS
|
||||
? false
|
||||
: {
|
||||
reserved: terserReservations(charsToReserve),
|
||||
toplevel: true,
|
||||
},
|
||||
mangle: {
|
||||
reserved: terserReservations(charsToReserve),
|
||||
toplevel: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -142,4 +141,4 @@ export default defineNuxtConfig({
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user