Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
VueJS 3 CLI project, TypeError default is not a constructor from ModalService

After creating a CLI project, I need to add a Modal dialog, after a bit of searching I found what seems to be a good example at Create Reusable MODALS Using VUE JS, by Shmoji . The tutorial is well written and there is a YouTube as well.

In the modual.service.js file the following code exists:

import Vue from 'vue';

export default new Vue({
   methods: {
   open(component, props = {}) {
      return new Promise((resolve, reject) => {
      this.$emit('open', { component, props, resolve, reject });
      });
    }
  }
})

Here is where I get the error that reads:

Uncaught TypeError: vue__WEBPACK_IMPORTED_MODULE_1__.default is not a constructor

It is pointing to the second line of code, export default new Vue({

In my main.js file, I already create Vue so it does not make sense to me why the modal author is trying to overwrite the Vue that already exists?

//main.js
import { createApp, reactive, computed, VueElement } from 'vue'
import App from './App.vue'
import router from './router'
import './assets/styles.css'
import moment from 'moment'
const app = createApp(App).use(router)
app.config.globalProperties.$moment=moment;
app.mount('#app')

Seems to me the global open method needs to be included in main.js but not sure how that is done or how to get around the above error if the modal service open method stays in its own file?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This Modal Dialog is not compatible with Vue3. I answered this question in more detail in this StackOverflow posting.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!