Vue globally defined scss variables such as $red:-sharpf00, cannot be directly referenced in components such as background: $red

common.scss is introduced globally in vue projects, and globally defined scss variables and mixin cannot be used in header components
common.csss:

$color_active:-sharp4381E6;

header.vue:

.cp_header{
    background: $color_active;
}
Mar.09,2021

style tag scoped this problem occurs


you need to configure sass-resources-loader
npm install sass-resources-loader-- save-dev

if you want to use it globally.

utils.js

scss: generateLoaders('sass').concat(
      {
        loader: 'sass-resources-loader',
        options: {
          resources: path.resolve(__dirname, '../src/assets/xxxx.scss')
        }
      }
    )
Menu