in asset/js/custom.js file when i do
import params from "@params"
I get this error
custom.js:2 Uncaught Error: Cannot find module '@params'
at webpackMissingModule (custom.js:2:50)
at eval (custom.js:2:132)
at ./assets/js/custom.js (app.bundle.js:19:1)
at __webpack_require__ (bootstrap:19:1)
at eval (index.js:11:78)
at ./src/index.js (app.bundle.js:169:1)
at __webpack_require__ (bootstrap:19:1)
I am new to hugo, how should i go about using env variables in .js file.
Please use the forum (https://discourse.gohugo.io/) for questions and troubleshooting. We prefer to use GitHub for verified bugs and vetted enhancements. Thanks.
I am using this hugo theme flowbite-admin-dashboard. It uses webpack as well. This is how it builds the website:
My site is hosted on netlify. There I use
npm run build
in production.I want to access environment variables (stored in netlify) in
asset/js/custom.js
file.I tried adding this to
layouts/_default/baseof.html
filein
asset/js/custom.js
file when i doimport params from "@params"
I get this errorI am new to hugo, how should i go about using env variables in .js file.