mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
The previous verbiage fallback loaded package.json via createRequire(), which broke Astro/Netlify prerender bundling because the relative package.json path is not available inside the generated chunk layout. Replace it with static fallback strings so the app-test text stays populated without depending on runtime file access. Constraint: Must restore Netlify production builds immediately Rejected: Revert the verbiage fix entirely | would reintroduce the blank app-test subtitle in production Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep public runtime fallbacks bundle-safe; do not require repo files from prerender/runtime chunks Tested: pnpm run typecheck (workspace); GitHub Actions failure analysis for netlify-build Not-tested: Full redeploy completion at commit time
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
const fallbackVerbiage = {
|
|
macs: 'Apple M4 Max or M3 Ultra Mac',
|
|
processors: 'Apple M4 Max and M3 Ultra'
|
|
}
|
|
|
|
function getRuntimeValue ( envValue, fallbackValue = null ) {
|
|
if ( typeof envValue === 'string' && envValue.length > 0 ) {
|
|
return envValue
|
|
}
|
|
|
|
return fallbackValue
|
|
}
|
|
|
|
export const publicRuntimeConfig = {
|
|
allUpdateSubscribe: process.env.ALL_UPDATE_SUBSCRIBE,
|
|
testResultStore: process.env.TEST_RESULT_STORE,
|
|
siteUrl: process.env.URL,
|
|
macsVerbiage: getRuntimeValue( process.env.npm_package_config_verbiage_macs, fallbackVerbiage.macs ),
|
|
processorsVerbiage: getRuntimeValue( process.env.npm_package_config_verbiage_processors, fallbackVerbiage.processors ),
|
|
}
|
|
|
|
export function makeViteDefinitions () {
|
|
const definitions = {}
|
|
|
|
for ( const key in publicRuntimeConfig ) {
|
|
definitions[`this.$config.${key}`] = JSON.stringify( publicRuntimeConfig[key] )
|
|
definitions[`global.$config.${key}`] = JSON.stringify( publicRuntimeConfig[key] )
|
|
definitions[`global.$config`] = JSON.stringify( publicRuntimeConfig )
|
|
}
|
|
|
|
return definitions
|
|
}
|