Vue3 Production Mode for CDN implementation

Viewed 4123

I get the console message You are running a development build of Vue. Make sure to use the production build (*.prod.js) when deploying for production.

I'm not using a webpack or any other bundler, it's just a static page just pulling from a CDN:

<script src="https://unpkg.com/vue@v3.1.1"></script>

just for context, we're instantiating Vue3 like this:

var vueApp = Vue.createApp({
  data() {return {display: 'Hello World'}},
}).mount('#vapp');

Is there a minimized production version of Vue3 I can pull instead of vue@v3.1.1?

3 Answers

Instead of using https://unpkg.com/vue@v3.1.1 which resolves to https://unpkg.com/vue@3.1.1/dist/vue.global.js

you can use https://unpkg.com/vue@3.1.1/dist/vue.global.prod.js

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

You can also use :

<script src="https://unpkg.com/vue@next"></script>

Use https://unpkg.com/vue/dist/vue.global.prod.js instead, it will redirect to latest version vue.global.prod.js.

// Example: 
// https://unpkg.com/vue/dist/vue.global.prod.js
//
// If the latest version is 3.2.37,
// It will redirect to 
// `https://unpkg.com/vue@3.2.37/dist/vue.global.prod.js`

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

NOTE:

It works with the same rule for axios CDN url.

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
Related