Mounting npm module from node_modules errors the toCSS method

When using hugo in my website, I am trying to use the Online 3D Viewer to show multiple 3d models on my website.

When I try to include the minified js using this code:

[mounts]
    source = 'node_modules/online-3d-viewer/build/engine/o3dv.min.js'
    target = 'assets/js/modelviewer'

,
Running hugo server -D gives me that output:

> test
> hugo server -D

Watching for changes in /home/mathis/Documents/Git/Freecad-library_Viewer/{content,layouts,node_modules,package.json,static}
Watching for config changes in /home/mathis/Documents/Git/Freecad-library_Viewer/config/_default
Start building sites … 
hugo v0.143.1-0270364a347b2ece97e0321782b21904db515ecc+extended linux/amd64 BuildDate=2025-02-04T08:57:38Z VendorInfo=gohugoio

WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
ERROR render of "/home/mathis/Documents/Git/Freecad-library_Viewer/content/about.md" failed: "/home/mathis/Documents/Git/Freecad-library_Viewer/layouts/page/about.html:3:3": execute of template failed: template: page/about.html:3:3: executing "page/about.html" at <partial "head.html" .>: error calling partial: "/home/mathis/Documents/Git/Freecad-library_Viewer/layouts/partials/head.html:16:45": execute of template failed: template: partials/head.html:16:45: executing "partials/head.html" at <toCSS $opts>: error calling toCSS: no Resource provided in transformation
Built in 4 ms
Error: error building site: render: failed to render pages: render of "/home/mathis/Documents/Git/Freecad-library_Viewer/content/_index.md" failed: "/home/mathis/Documents/Git/Freecad-library_Viewer/layouts/page/home.html:3:3": execute of template failed: template: page/home.html:3:3: executing "page/home.html" at <partial "head.html" .>: error calling partial: "/home/mathis/Documents/Git/Freecad-library_Viewer/layouts/partials/head.html:16:45": execute of template failed: template: partials/head.html:16:45: executing "partials/head.html" at <toCSS $opts>: error calling toCSS: no Resource provided in transformation

I should note that I got this errors when previously trying to include the npm-installed version of bootstrap and that it prompted me to use their CDN.

I hope i’ve given enough logs, if something is missing please let me know and thx for the help.

Two problems:

  1. Each mount must be an array element.
  2. You need to add the default mount.

In config/_default/module.toml change this:

[mounts]
source = 'node_modules/online-3d-viewer/build/engine/o3dv.min.js'
target = 'assets/js/modelviewer'

To this:

[[mounts]]
source = 'assets'
target = 'assets'

[[mounts]]
source = 'node_modules/online-3d-viewer/build/engine/o3dv.min.js'
target = 'assets/js/modelviewer'

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.