Dependencies
Thulite helps you build scalable and maintainable websites and leverages npm to explicitly declare and isolate dependencies.
Explicit declaration and isolation
The Dependencies section of the Twelve-Factor App encourages every app to declare and isolate all required dependencies.
In practice, this means:
- Use a dependency manifest to list what your project needs.
- Use a package manager or module system to install dependencies in a reproducible way.
- Avoid hidden dependencies from the host machine.
This improves reliability across environments and makes onboarding easier for new contributors.
JavaScript
For JavaScript projects, this usually means declaring dependencies in package.json and installing them with
npm.
npm installs packages into a local node_modules directory, so your project does not depend on globally installed system packages. This keeps builds consistent between local development, CI, and production.
Thulite
In Thulite,
integrations are npm packages declared in your project’s package.json.
Thulite then uses Hugo’s module configuration to
mount relevant files from dependency node_modules directories into Hugo
component directories. This makes those assets available to Hugo during the build process.
Pros
- Centralizes dependency management in
package.json. - Familiar workflow for teams already using npm.
- Access to the broader JavaScript ecosystem and tooling.
Cons
- Different from the default Hugo dependency workflow.
Hugo
You can also manage dependencies with Hugo Modules. In that approach:
- Declare dependencies in a
go.modfile. - Use Hugo’s module system to pin and resolve versions consistently.
Hugo also provides
hugo mod npm pack, which generates a composite package.json from package.hugo.json files in your project and modules.
Pros
- Aligns with the standard Hugo module workflow.
Cons
- Using Hugo Modules requires you to have Go installed.
- Using npm alongside Hugo Modules introduces two dependency systems.
- Hugo’s integrated npm support is still experimental.
- Hugo’s integrated npm support is limited. For example,
scriptsinpackage.jsonare not supported.
Chosen approach
Thulite chooses npm as the primary dependency manager because it keeps integrations and frontend tooling in one familiar workflow, without requiring Go or maintaining two parallel dependency systems. Hugo Modules are still used for mounting and composition, but npm-first dependency management gives most teams a simpler and more predictable setup.