React sourcemap warns it can't find components in nested directories
14:15 10 Jul 2026

I have a React v17.0.1 application with the following directory structure:

src/
  appName/
     pages/
        MainComponent/
          common/
             category/
             index.ts
                 SubComponent/
                    index.ts
                    SubComponent.tsx

I'm using webpack-dev-server and gulp to serve my project, which compiles but I have a lot of sourcemap warnings, for example:

Failed to parse source map from '/Users/.../src/appName/pages/MainComponent/common/SubComponent.tsx' file: Error: ENOENT: no such file or directory, open '/Users/.../src/appName/pages/MainComponent/common/category/SubComponent.tsx'

common/index.ts as well as SubComponents/index.ts both import SubComponent.tsx. If I remove the barrel file in common/index the warning goes away. Why is that the behaviour I am seeing?

Is it bad practice to import the same component in two index.ts files?

best-practices reactjs