replaced isDebug with env

This commit is contained in:
Kawanaao 2023-12-06 20:29:03 +02:00
parent bdc8d43a7b
commit 5acaded613
No known key found for this signature in database
GPG key ID: 5B7A8DDCE861E7DC
5 changed files with 7 additions and 8 deletions

View file

@ -6,7 +6,7 @@ import * as _market from './market';
import * as _constellation from './constellation';
import * as _metrics from './metrics';
/// #if DEMO
/// #if ENV == "demo"
import * as authDemo from './authentication.demo';
import * as usersDemo from './users.demo';
import * as configDemo from './config.demo';
@ -218,7 +218,7 @@ let market = _market;
let constellation = _constellation;
let metrics = _metrics;
/// #if DEMO
/// #if ENV == "demo"
auth = authDemo;
users = usersDemo;
config = configDemo;

View file

@ -4,7 +4,7 @@ import { logout } from '../api/authentication';
function useClientInfos() {
const [cookies] = useCookies(['client-infos']);
/// #if DEMO
/// #if ENV == "demo"
const demoReturn = {
nickname: "Demo",
role: "2"

View file

@ -8,7 +8,7 @@ import { debounce, isDomain } from './indexs';
import * as API from '../api';
import { useEffect, useState } from 'react';
/// #if DEMO
/// #if ENV == "demo"
import demoicons from './icons.demo.json';
/// #endif
@ -56,7 +56,7 @@ export const getFullOrigin = (route) => {
}
export const getFaviconURL = (route) => {
/// #if DEMO
/// #if ENV == "demo"
const demoReturn = route.Mode == "STATIC" ? Folder : demoicons[route.Name] || logogray;
if (demoReturn)

View file

@ -78,7 +78,7 @@
"terser": "npm:@swc/core"
},
"scripts": {
"webpack:setup-env": "cross-env isDemo=$npm_config_use_demo production=$npm_config_use_production withReport=$npm_config_with_report analyzeDeps=$npm_config_analyze_deps",
"webpack:setup-env": "cross-env NODE_ENV=$NODE_ENV production=$npm_config_use_production withReport=$npm_config_with_report analyzeDeps=$npm_config_analyze_deps",
"webpack:build": "npm run webpack:setup-env -- webpack --config webpack.prod.js --progress",
"webpack:serve": "npm run webpack:setup-env -- webpack serve --config webpack.dev.js --progress",
"backend:build": "sh build.sh",

View file

@ -4,7 +4,6 @@ const { join } = require("path")
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
const isDemo = !!process.env.isDemo
const withReport = !!process.env.withReport
const analyzeDeps = !!process.env.analyzeDeps
@ -33,7 +32,7 @@ module.exports = {
{
loader: "ifdef-loader",
options: {
DEMO: isDemo,
ENV: process.env.NODE_ENV,
"ifdef-uncomment-prefix": "// #code "
}
},