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

254
Visualizações
how to use npm package with hugo

I have a simple hugo site made with this command

hugo new site quickstart

and inside layouts/_default/baseof.html i have included a JavaScript file, named script.js and inside script.js i have this code:

import $ from 'jquery'

but when i check my browser console, it shows me this error:

Uncaught TypeError: Error resolving module specifier “jquery”. Relative module specifiers must start with “./”, “../” or “/”.

in my root folder, where i have all the folders like "content", "data", "public", "archetypes" i have installed jquery using npm but i still get this error.

Note: I don't want to include jquery from a cdn, or download the file.

Edit:

I tried using relative path to jquery inside node_modules folder using this code:

import $ from '../../../node_modules/jquery/dist/jquery.min'

but then get this error:

GET http://localhost:1313/node_modules/jquery/dist/jquery.min
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