Node_modules path with a mounted subproject

Hey,

I have a site that I’d like to rebuild with hugo, and I can’t build an external typescript module with js.Build, which builds just fine when using esbuild. This module builds also fine separately with webpack.

Basically what I do is, I check out karolyi/karolyimusic-webplayer: Icecast player for karolyimusic.com - karolyimusic-webplayer - KSOL Gitea as a submodule into the submodules/karolyimusic-webplayer directory, and execute npm install there to have a separate node_modules directory added for this submodule. Then, I add this to module.mounts:

module:
  # imports:
  #   - path: submodules/karolyimusic-webplayer
  mounts:
    - source: submodules/karolyimusic-webplayer
      target: assets/submodules/karolyimusic-webplayer

(as you can see, I also tried to use it as a module)

For testing’s sake, I added the following test.ts file to the src directory, next to index.ts in my project:

import { faPlay } from "@fortawesome/free-solid-svg-icons/faPlay"

const variable: string = 'Hello World from player test'

console.debug('XXX', variable, faPlay)
// console.debug('XXX', variable)

This would test if imports are working.

So when using the following snippet to debug:

{{- $js := resources.Get "submodules/karolyimusic-webplayer/src/test.ts" | js.Build -}}
{{ printf "%#v" $js.Content }}

I get the following error in the console
Could not resolve "@fortawesome/free-solid-svg-icons/faPlay"

Which to me means that the node_modules directory is somehow not found by js.Build. I’m willing to add the extra path to esbuild (if there would be a possibility), but like I mentioned, I also tested it with the esbuild command separately run from the main project directory and it ran just fine.

So now I’m kinda clueless as to what I could be doing wrong.

Any help is appreciated. So far I’m enjoying hugo very much.

I don’t think anyone could ever wrap their head around your problem without seeing the actual (failing) source project.

Thanks for the fast reply. That can be arranged:

Mind you I’m a total beginner with hugo (only working with it for 3 days now reading the forum and the documentation/github issues), so you might find some stuff that still needs to be ironed out. :slight_smile:

as for the submodule access, you might be better off using the HTTP url for it: karolyi/karolyimusic-webplayer: Icecast player for karolyimusic.com - karolyimusic-webplayer - KSOL Gitea