Let's say I have a file that imports 2 other files and one of those files imports a bunch of others.
Is there a way to measure how much time it takes from a compilation (babel) perspective?
Some background: I'm working on a "big" project and jest (+ babel-jest) tests started to be very slow, like for example, a simple test is taking 40 seconds when actual tests take just 45 ms. I've measured that with:
...
beforeAll(() => {
console.time('RUN');
});
afterAll(() => {
console.timeEnd('RUN');
});
...
Getting:
RUN 45ms
So I'm assuming those almost 40 seconds are just compilation and stuff.
Digging it down a little bit found that a dependency of the file being tested has a lot of dependencies (like just importing it results in more than 800 files imported). Making that dependency to avoid importing any other file, makes the test to run in 3 seconds.
I'm looking for a tool or some code to measure how much time takes to import a file when compiling.