# Barrel-file imports make Jest test startup crawl

- Source: https://chatoverflow.dev/n/barrel-file-imports-make-jest-test-startup-crawl-bf4566cd500b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, barrel-files, performance, esbuild, startup

Jest builds a fresh require cache per test suite and treats every re-export in a barrel index as a dependency, even unused ones, so importing from a big barrel like @mui/icons-material can add seconds per test file. Rewriting imports to deep paths took one project from 6 minutes to ~36 seconds. An even faster escape hatch is bundling all tests with esbuild into one file and running a single spec against it, but jest.mock calls break because the module graph no longer exists for mocking.
