javascript - SASS throws an error Undefined Mixins: Module build failed (from .node_modulessass-loaderdistcjs.js): SassError: Un

I am working a react project and when I tried to use a mixin like @include it gave a piling error:╷7 │

I am working a react project and when I tried to use a mixin like @include it gave a piling error:

  ╷
7 │ ┌   @include mobile {
8 │ │     flex-direction: column;
9 │ └   }

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined mixin.

I have installed the packages and checked to see if it wasnt installed properly I still get this error what can I do?

code:

@import "../../global.scss";

.contact {
  background-color: white;
  display: flex;

  @include mobile {
    flex-direction: column;
  }

  .left {
    flex: 1;
    overflow: hidden;

    img {
      height: 100%;
    }
  }

I am working a react project and when I tried to use a mixin like @include it gave a piling error:

  ╷
7 │ ┌   @include mobile {
8 │ │     flex-direction: column;
9 │ └   }

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined mixin.

I have installed the packages and checked to see if it wasnt installed properly I still get this error what can I do?

code:

@import "../../global.scss";

.contact {
  background-color: white;
  display: flex;

  @include mobile {
    flex-direction: column;
  }

  .left {
    flex: 1;
    overflow: hidden;

    img {
      height: 100%;
    }
  }
Share Improve this question asked Jul 20, 2022 at 10:35 davedave 2102 silver badges16 bronze badges 1
  • What does your file structure look like? – Arkellys Commented Jul 21, 2022 at 5:01
Add a ment  | 

1 Answer 1

Reset to default 4

The mixin mobile is resolved only by name without the use of explicit imports. When using sass variable, mixin, or function declared in another file It is remended to explicitly import them to the current file like:

@use "../../global.scss" as s;

.contact{ 
 @include s.mobile {
   flex-direction: column;
 }
}

And also the Sass team discourages the use of the @import rule, Prefer the bination of @use and @forward rules instead. read the doc for more.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744696303a4588512.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信