The current site I run build over 15,000 pages of articles, and has an API from a Django instance. The plan is to have hugo manage just the static content and use JS to fetch the different lists of articles.
There’s an index.js file in assets/js, and npm packages are installed in assets/node_modules
Error: Error building site: JSBUILD: failed to transform "js/index.js" (text/javascript):
"/Users/brunoamaral/Labs/gregory-ms-website/assets/node_modules/handlebars/lib/index.js:17:19":
Could not resolve "fs"
Is this the right way to build javascript assets with hugo?
Unfortunately I cannot get the submodules (I don’t have the rights). So I cannot really make the site work on my machine.
I was able to make your index.js work on a repo of mine, using the same npm dependencies… I just updated the package.json to move fs to “devDependencies” rather than “dependencies”
I usually delete my node_modules dir in between npm install just to be sure…
import htmx from "htmx.org";
import "htmx.org/dist/ext/client-side-templates.js"
import Handlebars from "handlebars"
hugo server:
Start building sites …
hugo v0.107.0+extended darwin/arm64 BuildDate=unknown
Error: Error building site: JSBUILD: failed to transform "js/index.js" (text/javascript): Could not resolve "fs"
Built in 2098 ms