У меня есть шина событий для MFES, и я хочу добавить имя файла в каждый отправленный объект, чтобы узнать, где происходит отправленное событие.// file: mfe-a.ts
import { dispatch } from "./eventBus";
export function doSomething() {
dispatch({ type: "ACTION_A" });
}
< /code>
export function dispatch(event) {
const err = new Error();
if (!err.stack) {
return {};
}
const callerLine = err.stack.split("\n")[3];
< /code>
is there better way to do it without writing filename in each file?
Подробнее здесь: https://stackoverflow.com/questions/797 ... s-executed