Subscribe on changes!

Help wanted! Cannot read property 'globalProperties' of undefined!

avatar
Mar 22nd 2021

Version

3.0.7

Reproduction link

https://codesandbox.io/s/charming-flower-tbv36?file=/src/main.ts

Steps to reproduce

See sandbox: https://codesandbox.io/s/charming-flower-tbv36?file=/src/main.ts

What is expected?

app.config.globalProperties.$http = Axios;

What is actually happening?

TypeError Cannot read property 'globalProperties' of undefined evaluate main.ts:16:11 13 | } 14 | const app = createApp(MainApp).use(store).use(router).mount("#app"); 15 |

16 | app.config.globalProperties.$http = Axios; | ^ 17 |

avatar
Mar 22nd 2021

Change this:

const app = createApp(MainApp).use(store).use(router).mount("#app");

to:

const app = createApp(MainApp)
app.use(store).use(router).mount("#app");