I'm working on a javascript react project that's being ported to typescript. Everything seems to be going fine, apart from the scss.
We use variables in our scss files, and the files work in javascript. However now that the app is migrating to react I'm getting this error message:
ERROR in ./src/ourApp/scss/config/interactive/_variables.scss (./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[1].oneOf[7].use[3]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[1].oneOf[7].use[4]!./src/ourApp/scss/config/interactive/_variables.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
╷
20 │ $vertical-menu-border: $white;
│ ^^^^^^
╵
src\ourApp\scss\config\interactive\_variables.scss 20:24 root stylesheet
the root cause of the issue seems to be that $white is being used before it's being declared and the issue goes away when I move the $white declaration above the $vertical-menu-border declaration. I'd go about re-ordering each and every scss variable to solve this but I'm unsure weather it's the correct thing to do given that there are several files to fix like this.
Why is this an issure in React.Typescript but not in React.Javascript?
Any advice? Could I potentially disable this scss error checker and if so how?