question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack build fails with "SassError: Undefined variable" when updating 5.1.3 -> 5.2.0

See original GitHub issue

Prerequisites

Describe the issue

When updating 5.1.3 -> 5.2.0 our webpack build fails with the following error:

error  in ./assets/scss/app.scss

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
    ╷
142 │       values: $utilities-border-colors
    │               ^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
  node_modules/bootstrap/scss/_utilities.scss 142:15  @import
  assets/scss/app.scss 14:9                           root stylesheet

That line just imports the utilities @import "~bootstrap/scss/utilities";

Reduced test cases

Don’t know how to provide a test case for this as we don`t even use that variable.

What operating system(s) are you seeing the problem on?

Linux

What browser(s) are you seeing the problem on?

No response

What version of Bootstrap are you using?

5.2.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:14
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

118reactions
julien-deramondcommented, Jul 20, 2022

Thanks for reporting this issue @gndk. There is a new _map.scss in v5.2.0. Don’t have the details regarding your Webpack build but you probably just need to @import "~bootstrap/scss/maps"; (that’s where $utilities-border-colors is defined) before @import "~bootstrap/scss/utilities";.

29reactions
fun2lifecommented, Jul 23, 2022

@turkic-dev: It is important to load the modules in the exact same order as in node_modules/bootstrap/scss/bootstrap.scss Also, the following modules must be loaded

@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/maps";
@import "~bootstrap/scss/mixins";
@import "~bootstrap/scss/utilities";
@import "~bootstrap/scss/helpers";
@import "~bootstrap/scss/utilities/api";
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - SassError: Undefined variable. Failing dependencies
I have a CI/CD pipeline for an Angular project which yesterday worked fine, but today the same code is returning several errors on...
Read more >
Add bootstrap colors - Developers Community by KeenThemes
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Undefined variable. ╷ 7 │ $all-colors: map-merge-multiple($ ...
Read more >
React.js Developers | Webpack 5 (with Module Federation) | Facebook
Webpack build fails with "SassError : Undefined variable" when updating 5.1.3 -. GITHUB.COM. Webpack build fails with "SassError: Undefined variable" when ...
Read more >
Bootstrap 5.2.0 beta
To summarize the problem, Sass has a limitation where once a default variable or map has been used, it cannot be updated. There's...
Read more >
Rails Webpacker and Sass undefined variable error
I've recently started using Webpacker with Rails as an alternative to the asset pipeline. In addition to compiling my Javascript assets I've ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found