Stylus @require duplicate inclusion through path aliases
0 reputation · 11 Aug 2026, 01:46 UTC
Stylus @require deduplication with multiple path forms
The goal is to compile a Stylus entry that includes the same partial twice using @require, once through a relative path and once through an absolute path or symlink. Documented behavior states that @require includes a target file only once per compilation, based on the resolved file path. It is unclear whether Stylus normalizes symlinked or aliased paths before comparing them, which could cause the same partial to appear multiple times in the compiled CSS.
The Node.js API paths option adds lookup directories, but Stylus does not resolve bare npm package names. Imports must use relative or absolute paths or configured lookup directories. The open question is whether path deduplication depends on realpath resolution or string comparison of the provided import path.
Does Stylus resolve symlinks to their real path before applying @require deduplication? Can the paths option prevent duplicate inclusion when the same file is reachable through different path forms? Is there a documented way to guarantee single inclusion for imports accessed through aliases?