The problem with this configuration is that it only resolves node_modules correctly if the file sits on the project root. If the file is in <project_root>/src/a/b/c.styl, the extracted dirname will be <project_root>/src/a/b and stylus will be given these paths: <project_root>/src/a/b and <project_root>/src/a/b/node_modules.
failed to locate @import file <imported file>
at Evaluator.visitImport
The node_modules path was wrong and rollup-plugin-styles should have used <project_root>/node_modules instead. As a quick workaround the following configuration should suffice:
Stylus loader uses the following options to support loading files from
node_modules
https://github.com/Anidetrix/rollup-plugin-styles/blob/418a5db352a8b402a723adfe74dc0cc830ba4121/src/loaders/stylus.ts#L22-L24
The problem with this configuration is that it only resolves
node_modules
correctly if the file sits on the project root. If the file is in<project_root>/src/a/b/c.styl
, the extracted dirname will be<project_root>/src/a/b
and stylus will be given these paths:<project_root>/src/a/b
and<project_root>/src/a/b/node_modules
.The
node_modules
path was wrong and rollup-plugin-styles should have used<project_root>/node_modules
instead. As a quick workaround the following configuration should suffice:I propose to expand tests to cover this case and use this to fix the problem.
If you think this is a good idea, I can submit a PR.
EDIT: Add workaround