[Vuejs]-Vuejs production cdn is not working https://unpkg.com/vue@3/dist/vue.global.prod.js

0👍

Besides the risk associated with the use of unpkg.com (it’s unreliable and not production ready), the problem is that broad version range is used, and Vue 3.3 resulted in a breaking change. It can be narrowed to minor version that’s known to be compatible:

<script src="https://unpkg.com/vue@3.2/dist/vue.global.prod.js"></script>

Error stack can be debugged to template compiler, the use of <script> inside DOM template causes this, the application relied on undocumented behaviour that script elements are just ignored, which is evidently not the case for Vue 3.3.

Either application root should be separated from the script:

<body>
  <div id="app">
    <h1>Test vue</h1>
    {{title}}
  <div>
  <script src="./app.js"></script>
</body>

Or <script> needs to be moved to document head, and the execution needs to be postponed until the document is ready.

Leave a comment