How to expose a value from capacitor sync/copy to the JS in the webview?

Can I do something like capacitor.config.ts

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.example.app',
  appName: 'MyApp',
  webDir: 'www',
  server: {
    androidScheme: 'https'
  },
  myCustomValue: 'HelloFromConfig'
};

export default config;

then

import { Capacitor } from '@capacitor/core';

const customValue = (window as any).Capacitor?.config?.myCustomValue;
console.log('Custom value from Capacitor config:', customValue);

myCustomValue is not supported by the capacitor config schema officially, so I am worried it will get wiped and not exposed to the JS in the webview.