Failed to load module script: Expected a JavaScript module for a stencil application

I have a stencil Application where on build the files are moved to s3, i see in my cloud formation template while uploading the content type is set as application/javascript.

name": "stencil-base/build/stencil-base_esm",
  "sourceLocation": "./stencil-base/build/stencil-base.esm.js",
  "destinationLocation": "stencil-base/build/stencil-base.esm.js",
  "headers": {
    "cache-control": "no-cache, no-store, must-revalidate, max-age=0",
    "x-amz-meta-content-security-policy": {
      "template": "default-src 'self' {{CloudFrontProtocol}}://{{CloudFrontDomain}}",
      "templateType": "handlebars"
    },
    "content-type": "application/javascript; charset=utf-8"
  },
  "replacements": []

But when the code is pulled from s3 . I get error in the browser .

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/html”. Strict MIME type checking is enforced for module scripts per HTML spec.

I tired changing the extension to .mjs but nothing works. what is the missing piece here