Skip to content

Undefined variable error when using sass @use (@import and forward) #18707

Answered by Milan-960
Milan-960 asked this question in Q&A
Discussion options

You must be logged in to vote

@use works differently from @import.

@use only makes variables, functions, and mixins available within the scope of the current file. It never adds them to the global scope. This makes it easy to figure out where each name your Sass file references comes from, and means you can use shorter names without any risk of collision.
https://sass-lang.com/documentation/at-rules/use/#differences-from-import

Probably you have to change $box-shadow-light to $filename.box-shadow-light or add as * after the @use.

Yup that is what I tried at some point even I updated the vite.config.ts and did tried inside the

  css: {
    preprocessorOptions: {
      scss: {
        // Use the new API for scss pre…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Milan-960
Comment options

Answer selected by Milan-960
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #18682 on November 19, 2024 07:11.