Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Can't import module / library in Vue

So i installed a slider library called hooper in VueJS 3, and i import it in my local like this

<template>
  <hooper>
    <slide>1</slide>
    <slide>1</slide>
    <slide>1</slide>
    <slide>1</slide>
    <slide>1</slide>
  </hooper>
</template>
<script>
 import { Hooper, Slide } from 'hooper'
 import 'hooper/dist/hooper.css'

 export default {
  components: {
    Hooper, Slide
  }
 }
</script>

Also i can't import hooper (import { Hooper, Slide } from 'hooper') There are three dots under the word hoope, and it says:

Could not find a declaration file for module 'hooper'. 'c:/Users/nurdi/pkl/template/java-vibes/node_modules/hooper/dist/hooper.js' implicitly has an 'any' type.


Try `npm i --save-dev @types/hooper` if it exists or add a new declaration (.d.ts) file containing `declare module 'hooper';`Vetur(7016)

Also there is an error on the console, it says:

Uncaught TypeError: vue__WEBPACK_IMPORTED_MODULE_0__.default is not a constructor
at eval (hooper.esm.js?7e04:172:1)
at Module../node_modules/hooper/dist/hooper.esm.js (chunk-vendors.js:1393:1)
at __webpack_require__ (app.js:849:30)
at fn (app.js:151:20)
at eval (GuestBook.vue?ed46:64:1)
at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/components/GuestBook.vue?vue&type=script&lang=js (app.js:986:1)
at __webpack_require__ (app.js:849:30)
at fn (app.js:151:20)
at eval (GuestBook.vue?9b66:1:1)
at Module../src/components/GuestBook.vue?vue&type=script&lang=js (app.js:1840:1)
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I think there are multiple issues in your file:

  • Could not find a declaration file [..] is a Typescript error, which is probably happening because the Vue CLI comes with TS out of the box. If you don't use TS, change <script> to <script lang="js">. I recommend always doing this either way.
  • Import vue and change export default {} export default Vue.extend({}) to let the app know it's a Vue component.
  • Uncaught TypeError: vue__WEBPACK_IMPORTED_MODULE_0__.default is not a constructor usually means a default import could not be found in the file you're referencing. Since you're not trying to import a module default, I can only hope that one of the previous two issues is the cause of this. It could very well be that this issue lies within the library itself.

P.S. I'm used to coding in Vue 2, so it's possible that some of my suggestions don't apply the exact same way in Vue 3.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda