Lazy values
Sometimes you can only get a valye after the module where it should be serialized to is created. When using the AIK Plugin, for example, you can only define an inline module during the astro:config:setup
hook, but you might want to serialize a value from other hooks.
import { lazyValue } from '@inox-tools/inline-mod';import { defineModule } from '@inox-tools/inline-mod/vite';
const value = lazyValue();
defineModule('virtual:your-plugin/config', { constExports: { value },});
value.set('hello');