| | |
| | | return { |
| | | name: PLUGIN_NAME, |
| | | async configResolved(_config) { |
| | | let appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; |
| | | appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); |
| | | const appTitle = _config?.env?.VITE_GLOB_APP_TITLE ?? ''; |
| | | // appTitle = appTitle.replace(/\s/g, '_').replace(/-/g, '_'); |
| | | publicPath = _config.base; |
| | | source = await getConfigSource(appTitle); |
| | | }, |
| | |
| | | * @param env |
| | | */ |
| | | const getVariableName = (title: string) => { |
| | | return `__PRODUCTION__${title || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, ''); |
| | | function strToHex(str: string) { |
| | | const result: string[] = []; |
| | | for (let i = 0; i < str.length; ++i) { |
| | | const hex = str.charCodeAt(i).toString(16); |
| | | result.push(('000' + hex).slice(-4)); |
| | | } |
| | | return result.join('').toUpperCase(); |
| | | } |
| | | return `__PRODUCTION__${strToHex(title) || '__APP'}__CONF__`.toUpperCase().replace(/\s/g, ''); |
| | | }; |
| | | |
| | | async function getConfigSource(appTitle: string) { |