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

368
Visualizações
Nuxt plugin does not copy imported files to .nuxt

In a Nuxt project (version 2.14.9) I have a plugin file /plugins/ui-components.js that starts like this:

import UiList from '../components/UiList.vue'
import UiPageHeading from '../components/UiPageHeading.vue'
// more imports etc.

In nuxt.config.js I reference a file like this:

{
  // ...
  buildModules: [
    {
      handler: require('../lib/module.js'),
      options: {},
    },
  ],
}

Finally in ..lib/module.js I have

this.addPlugin({
    fileName: path.join(OUTPUT_DIR, 'plugins', 'ui-components.js'),
    src: path.resolve(__dirname, 'plugins/ui-components.js'),
    options: {
      registerDynamicComponentGlobally:
        options.registerDynamicComponentGlobally,
    },
  })

Now when I build or run the project ui-components.js gets copied to .nuxt, but not the .vue files that it imports. How can I fix this? My current workaround is to "manually" copy the files to .nuxt but of course I am looking for a better solution. Could it be that the plugin files need to be "stand-alone" meaning they are not allowed to import/require other dependencies?

about 4 years ago · Juan Pablo Isaza
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