mongodb / stitch-js-sdk

MongoDB Stitch JavaScript SDK
Apache License 2.0
113 stars 67 forks source link

Mime Type Issue #308

Open michaeldanielbell opened 5 years ago

michaeldanielbell commented 5 years ago

Hello,

When trying to import the Js Lib I am receiving this error: Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

import { Stitch } from 'mongodb-stitch-browser-sdk';

It seems to be coming from buffer.js. FYI: My entry point is an esm module

adamchel commented 5 years ago

Hi @michaeldanielbell ,

Could you tell me a little more about the environment that you are trying to build in? Are you building a browser application with some sort of framework? I'll need a bit more information to help you

michaeldanielbell commented 5 years ago

I'm using http://open-wc.org, which is basically web components client side only app. I use rollup to build the application which has this entrypoint.

   <script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.5.0/stitch.js"></script>
    <script type="module" type="text/javascript" src="/src/club-tiger.js"></script>
  </body>

The only way I can get it to work is to just embed the script tag. When trying to use es imports I get the mime type issue