Rails-React app deployment fails on esbuild bundling because of inconsistent case-sensitiveness

I try to deploy a rails-react app and get an unexpected behaviour. When I try to deploy, deployment fails under certain conditions. I use Rails 7 with esbuild in combination with React. The deployment happens through Capistrano.

When I first tried to deploy the app from development to production I had yarn/node complain through capistrano about case-sensitive filenames. It worked in development, but did not precompile in production. After changing the filenames of the few components I had to small case, I was able to deploy. Now I have continued with my work and encountered a situation, where certain filenames need to be PascalCase and others follow a small case variant, such as snake_case. I do not know what is going on.

I get the following output:

00:11 deploy:assets:precompile
      01 ~/.rvm/bin/rvm 3.2.1 do bundle exec rake assets:precompile
      01 yarn install v1.22.19
      01 [1/4] Resolving packages...
      01 [2/4] Fetching packages...
      01 [-----------------------------------] 0/35
      01 [3/4] Linking dependencies...
      01 [--------------] 0/14
      01 [-----------------------------------------------------------------------] 0/361
      01 [#################################################--------------------] 255/361
      01 [#####################################################################] 361/361
      01 [----------------------------] 0/28
      01 [4/4] Building fresh packages...
      01 [############################] 28/28
      01 [1/1] ⠂ esbuild
      01 Done in 0.44s.

      01 yarn run v1.22.19
      01 $ esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets
      01 ▲ [WARNING] Use "app/javascript/components/resources.jsx" instead of "app/javascript/components/Resources.jsx" to avoid issues with case-sensitive file systems [different-path-case]
      01     app/javascript/routes/index.jsx:4:22:
      01       4 │ import Resources from "../components/Resources.jsx";
      01         ╵                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      01 ✘ [ERROR] Could not read from file: /home/amazing_account/apps/super_new_app/releases/20230304052541/app/javascript/components/Resources.jsx
      01     app/javascript/routes/index.jsx:4:22:
      01       4 │ import Resources from "../components/Resources.jsx";
      01         ╵                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      01 1 warning and 1 error
      01 node:child_process:924
      01     throw err;
      01     ^

      01 Error: Command failed: /home/amazing_account/apps/super_new_app/releases/20230304052541/node_modules/@esbuild/linux-x64/bin/esbuild app/javascript/application.js --bundle --sourcemap --outdir=app/assets/builds --public-path=ass…
      01     at checkExecSyncError (node:child_process:885:11)
      01     at Object.execFileSync (node:child_process:921:15)
      01     at Object.<anonymous> (/home/amazing_account/apps/super_new_app/releases/20230304052541/node_modules/esbuild/bin/esbuild:220:28)
      01     at Module._compile (node:internal/modules/cjs/loader:1275:14)
      01     at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
      01     at Module.load (node:internal/modules/cjs/loader:1133:32)
      01     at Module._load (node:internal/modules/cjs/loader:972:12)
      01     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
      01     at node:internal/main/run_main_module:23:47 {
      01   status: 1,
      01   signal: null,
      01   output: [ null, null, null ],
      01   pid: 3864772,
      01   stdout: null,
      01   stderr: null
      01 }

      01 Node.js v19.6.1
      01 error Command failed with exit code 1.
      01 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
      01 rake aborted!
      01 jsbundling-rails: Command build failed, ensure yarn is installed and `yarn build` runs without errors
      01 /home/amazing_account/apps/super_new_app/shared/bundle/ruby/3.2.0/gems/jsbundling-rails-1.1.1/lib/tasks/jsbundling/build.rake:5:in `block (2 levels) in <main>'
      01 /home/amazing_account/apps/super_new_app/shared/bundle/ruby/3.2.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
      01 /home/amazing_account/.rvm/rubies/ruby-3.2.1/bin/ruby_executable_hooks:22:in `eval'
      01 /home/amazing_account/.rvm/rubies/ruby-3.2.1/bin/ruby_executable_hooks:22:in `<main>'
      01 Tasks: TOP => assets:precompile => javascript:build
      01 (See full trace by running task with --trace)

Has anyone an idea where to turn? Rails, Esbuild, Yarn?