Matt
Matt

Reputation: 10312

Enabling performance config setting in Vue 3

When trying to enable the performance setting in Vue 3 I get the following error:

TypeError: can't access property "performance", app.config is undefined

My entry point (main.js) looks like this:

import App from './App.vue';
import { createApp } from 'vue';

const app = createApp(App).mount('#app');

if (process.env.NODE_ENV === 'development') {
    app.config.performance = true;
}

Upvotes: 3

Views: 1989

Answers (1)

Matt
Matt

Reputation: 10312

This was due to mount not returning an app instance.

Solution:

const app = createApp(App);

if (process.env.NODE_ENV === 'development') {
    app.config.performance = true;
}

app.mount('#app');

Upvotes: 3

Related Questions