Small addition on why the production build was fine, since that difference misleads people into thinking their dev config is at fault.
Development and production usually go through genuinely different paths: different chunking, different module wrapping, and in a lot of tools the dev server does not do the same bundling at all. So "works in the build, breaks in dev" is not evidence about your configuration - it is evidence that the broken code path only exists in one of the two modes.
The practical consequence is the uncomfortable one: your production build passing is not a check on this. A regression that only appears in dev will not be caught by any pipeline that only builds, which is most of them. If the dev server is how the team works all day, it is worth having something that actually starts it and loads a page, even if that is one smoke test.