Sass Error: Module loop: this module is already being loaded.

Error in plugin "sass"
Message:
scss/main/tools/functions/_gutter.scss
Error: Module loop: this module is already being loaded.
┌──> scss/main/tools/functions/_gutter.scss
2 │ @use "../../abstracts" as *;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ new load

┌──> scss/main/base/fonts/_index.scss
2 │ @use "../../abstracts";
│ ━━━━━━━━━━━━━━━━━━━━━━ original load


scss/main/tools/functions/_gutter.scss 2:1 @forward
scss/main/tools/functions/_index.scss 3:1 @forward
scss/main/tools/_index.scss 1:1 @use
scss/main/abstracts/_colors.scss 2:1 @forward
scss/main/abstracts/_index.scss 1:1 @use
scss/main/base/fonts/_index.scss 2:1 @use
scss/main/base/_index.scss 1:1 @use
scss/main/default.scss 1:1 root stylesheet
Error in plugin "sass"
Message:
scss/main/tools/functions/_gutter.scss
Error: Module loop: this module is already being loaded.
┌──> scss/main/tools/functions/_gutter.scss
2 │ @use "../../abstracts" as *;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ new load

┌──> scss/main/base/fonts/_index.scss
2 │ @use "../../abstracts";
│ ━━━━━━━━━━━━━━━━━━━━━━ original load


scss/main/tools/functions/_gutter.scss 2:1 @forward
scss/main/tools/functions/_index.scss 3:1 @forward
scss/main/tools/_index.scss 1:1 @use
scss/main/abstracts/_colors.scss 2:1 @forward
scss/main/abstracts/_index.scss 1:1 @use
scss/main/base/fonts/_index.scss 2:1 @use
scss/main/base/_index.scss 1:1 @use
scss/main/default.scss 1:1 root stylesheet
- default.scss <-- @use "base";; - base/_index.scss <-- @use "fonts"; - fonts/_index.scss <-- @use "../../abstracts"; - tools/_index.scss <-- @forward "functions"; - functions/_index.scss <-- @forward "gutter"; - _gutter.scss <-- @use "../../abstracts" as *; - folder "abstracts" contains variables and settings of all sorts (e.g. breakpoints, colors, globals, spacings, typography, etc.) - folder "tools" contains functions and mixins (possibly require variables defined in abstracts) - both abstracts and tools will be used project wide (e.g. accessing color variables or use breakpoint mixin in sass components) - folder "base" contains styles for pure html elements (e.g. html, body, ul, h1, etc.) I need to access variables from abstracts in multiple places. Also, I want to access variables within abstractions itself like use variable x in abstraction a from abstraction b. How does this work without running into the module loop problem?
1 Reply
Sergio Salami
Sergio SalamiOP11mo ago
Another example: Let’s say you have files A, B, and C, where - A forwards B and C - B uses C - C uses B. Partials A, B, C are in the same folder “abstracts”. _index.scss (A) forwards _global.scss (B) and _unit.scss (C). _global.scss (B) “uses” sass-functions from _unit.scss (C). And _unit.scss (C) “uses” global variables from _globals.scss (B). How is this possible? 🤯 I also want to use parts of B and C in D which could be another partial that lives somewhere else (for instance, _cards.scss in components folder). So I would load A with @use "abstracts" as * (which forwards B and C) to access variables/functions/mixins from both B and C.
Want results from more Discord servers?
Add your server