Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import {inspect} from 'import-inspector';
const imported = [];
// setup a watcher
let stopInspecting = inspect(metadata => {
imported.push(metadata);
});
function flush() {
let copy = imported.slice();
imported.length = 0;
return copy;
}
render();
flush();
// [{ importedModulePath: "./module" }, ...]
render();
flush();
// [{ importedModulePath: "./module" }, ...]
stopInspecting();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment