Is there a way to get the current module scope as an object (kind of like this inside a function)
export let num = 5;
export let str = "hello world";
export const set = (name, value) => moduleObj[name] = value;
It is worth mentioning that I don't want to add num and str to a registry object, or other boilerplate like that.
It does not seem to be possible in node (Access NodeJS module scope variables as object) However because webpack packs things into functions, this would normally work. Unforantly, webpack replaces this with undefined when it is top scope. Is there any way I could do this?