1

I'm using a CDN to play around with Vue 3.

From my index.html, I'm importing my app.js file like this -

<script src="app.js"></script>

The app.js file contains this code -

import createApp  from 'vue'
import Root from './App.vue'

createApp(Root)
    .mount('#app')

I can eliminate this error by adding type="module" to the script tag which will then give me another error involving a MIME type -

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec.

Why is this happening and how can I fix this?

Harrison Greeves
  • 317
  • 3
  • 10
  • Does this answer your question? ["Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6](https://stackoverflow.com/questions/58211880/uncaught-syntaxerror-cannot-use-import-statement-outside-a-module-when-import) – shaedrich Dec 21 '21 at 07:02

0 Answers0