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