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

252
Views
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
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!