【问题标题】:Parcel Bundler: import scss files from node_modules without specifying the full path?Parcel Bundler:从 node_modules 导入 scss 文件而不指定完整路径?
【发布时间】:2018-06-08 15:06:30
【问题描述】:

目前,我像这样导入 scss 文件:

@import './node_modules/bulma/bulma';

但是,在 Laravel Mix 中,我了解到我可以像这样导入文件,而无需指定 ./node_modules

@import '~bulma/bulma';

无论如何我可以在 ParcelJS 中做到这一点?

【问题讨论】:

    标签: parceljs


    【解决方案1】:

    webpack 中的 sass-loader 使用 node-sass 的自定义导入器功能将所有查询传递给 webpack 解析引擎。

    但是在包裹捆绑器中,

    尚未为 SASS/SCSS 实现 node_modules 解析算法。目前您可以制作一个 .sassrc 或 .sassrc.js 文件来配置 node-sass 的 includePaths 选项以包含 node_modules。

    找到当前解决方法in this discussion

    【讨论】:

      猜你喜欢
      • 2019-11-05
      • 2013-06-06
      • 1970-01-01
      • 1970-01-01
      • 2018-02-22
      • 2018-10-01
      • 2021-07-20
      • 2018-12-01
      • 1970-01-01
      相关资源
      最近更新 更多