Worker was prevented from loading due to an unauthorized MIME type ("text/html")

I’m encountering a MIME type error with a web worker in my Angular application using esbuild. The worker fails to load in Firefox with the following error:

While Chrome doesn’t show the error, the worker still doesn’t function properly there either.
Angular Version:18

Builder: @angular-devkit/build-angular:browser-esbuild

  1. Start the Angular development server

  2. Open the application in Firefox

The issue occurs with the decodeImageFrameWorker.js web worker