使用 Laravel Mix 从 Stylus 中的 node_modules 导入

Osk*_*oos 5 stylus webpack laravel-mix

我有一个大型 Stylus 项目,需要从 vanilla Gulp 移植到 Laravel Mix 中。

其中app.styl包括另一个来自node_modules 的framework.styl内容@import。我无法在 Laravel Mix 中使用use和import标志(或者至少我不知道如何使用),因为

  1. 对于某些依赖项,我只需要导入 node_modules 文件夹中的特定文件,而不是整个文件
  2. 对于一个依赖项,我需要在导入 Stylus之前在其内部设置一长串变量。

主样式

@import "includes/framework.styl"

/* Other stuff */
Run Code Online (Sandbox Code Playgroud)

包括/framework.styl

$variable = 1.5
$other = white
/* bunch more */

@import "jeet"
@import "foo/src/specific.styl"

ks-no-conflict = true
@import "kouto-swiss"

/* other stuff */
Run Code Online (Sandbox Code Playgroud)

@import中的所有s 都framework.styl来自node_modules。这些依赖项和文件的加载顺序很重要,因为如果加载顺序错误,它们可能会相互冲突。

但是,当我运行时npm run dev,它抱怨无法在 中找到任何依赖项位置framework.styl。

我尝试@import在路径前加上~/, node_modules/, ./node_modules/,../../../../node_modules等前缀;似乎没有任何作用。这一切都导致:

failed to locate @require file node_modules/jeet/styl/index.styl
Run Code Online (Sandbox Code Playgroud)

通过../../../../node_modules和../../../node_modules,我得到以下结果;

Module build failed: Error: EISDIR: illegal operation on a directory, read
    at Error (native)
Run Code Online (Sandbox Code Playgroud)

我怎样才能让 Stylus 在 node_modules (我的首选解决方案)中找到这些依赖项,或者在 Laravel Mix 选项中复制上述内容?