Replace require with import when migrating from webpacker to esbuild?

I gave up webpacker and switched to esbuild One of my jsx files has a lot of require statements in it I think I have to swap them out for import statements?

I’m not addressing your question but have you considered switching to shakapacker instead of esbuild? I’m in the process of doing that for a fairly big application and updating dependencies by multiple major versions:

  • Node 10 => 18
  • Webpack 3 => Webpack 5
  • Webpacker 3.6 => Shakapacker 7.1

It involved removing a lot of custom configuration which webpack/shakapacker added under the hood so my boilerplate config was no longer necessary