Sass 报错 “@use rules must be written before any other rules”

解决定义的scss变量在@use "sass:map";前面报错。

    preprocessorOptions: {
      // 向全局sass样式传入共享的全局变量,注入 `scss` 的 `mixin` `variables` 到全局
      scss: {
        additionalData: `
     @import "@/assets/style/_variables.scss";
        `
      }
    }

变为

    preprocessorOptions: {
      // 向全局sass样式传入共享的全局变量,注入 `scss` 的 `mixin` `variables` 到全局
      scss: {
        additionalData: `
        @use "@/assets/style/_variables.scss" as *;
        `
      }
    }
posted @ 2023-02-10 11:14  shine_lovely  阅读(3009)  评论(0编辑  收藏  举报