File tree Expand file tree Collapse file tree 3 files changed +12
-25
lines changed Expand file tree Collapse file tree 3 files changed +12
-25
lines changed Original file line number Diff line number Diff line change @@ -133,17 +133,17 @@ module.exports = {
133133 // pass options to sass-loader
134134 // @/ is an alias to src/
135135 // so this assumes you have a file named `src/variables.sass`
136- // Note: this option is named as "data " in sass-loader v7
136+ // Note: this option is named as "prependData " in sass-loader v8
137137 sass: {
138- prependData : ` @import "~@/variables.sass"`
138+ additionalData : ` @import "~@/variables.sass"`
139139 },
140140 // by default the `sass` option will apply to both syntaxes
141141 // because `scss` syntax is also processed by sass-loader underlyingly
142- // but when configuring the `data ` option
142+ // but when configuring the `prependData ` option
143143 // `scss` syntax requires an semicolon at the end of a statement, while `sass` syntax requires none
144144 // in that case, we can target the `scss` syntax separately using the `scss` option
145145 scss: {
146- prependData : ` @import "~@/variables.scss";`
146+ additionalData : ` @import "~@/variables.scss";`
147147 },
148148 // pass Less.js Options to less-loader
149149 less: {
Original file line number Diff line number Diff line change @@ -135,17 +135,17 @@ module.exports = {
135135 // передача настроек в sass-loader
136136 // @/ это псевдоним к каталогу src/ поэтому предполагается,
137137 // что у вас в проекте есть файл `src/variables.scss`
138- // Примечание: эта опция называется "data " в sass-loader v7
138+ // Примечание: эта опция называется "prependData " в sass-loader v8
139139 sass: {
140- prependData : ` @import "~@/variables.sass"`
140+ additionalData : ` @import "~@/variables.sass"`
141141 },
142142 // по умолчанию опция `sass` будет применяться к обоим синтаксисам
143143 // потому что синтаксис `scss` по сути также обрабатывается sass-loader
144- // но при настройке опции `data ` синтаксис `scss` требует точку с запятой
144+ // но при настройке опции `prependData ` синтаксис `scss` требует точку с запятой
145145 // в конце оператора, в то время как для `sass` точки с запятой не требуется
146146 // в этом случае синтаксис `scss` можно настроить отдельно с помощью опции `scss`
147147 scss: {
148- prependData : ` @import "~@/variables.scss";`
148+ additionalData : ` @import "~@/variables.scss";`
149149 },
150150 // передача настроек Less.js в less-loader
151151 less: {
Original file line number Diff line number Diff line change @@ -126,29 +126,16 @@ module.exports = {
126126 sass: {
127127 // @/ 是 src/ 的别名
128128 // 所以这里假设你有 `src/variables.sass` 这个文件
129- // 注意:在 sass-loader v7 中,这个选项名是 "data "
130- prependData : ` @import "~@/variables.sass"`
129+ // 注意:在 sass-loader v8 中,这个选项名是 "prependData "
130+ additionalData : ` @import "~@/variables.sass"`
131131 },
132132 // 默认情况下 `sass` 选项会同时对 `sass` 和 `scss` 语法同时生效
133133 // 因为 `scss` 语法在内部也是由 sass-loader 处理的
134- // 但是在配置 `data ` 选项的时候
134+ // 但是在配置 `prependData ` 选项的时候
135135 // `scss` 语法会要求语句结尾必须有分号,`sass` 则要求必须没有分号
136136 // 在这种情况下,我们可以使用 `scss` 选项,对 `scss` 语法进行单独配置
137137 scss: {
138- // sass-loader v8语法
139- // prependData: `@import "~@/variables.scss";`
140- // sass-loader v9语法
141- additionalData (content , loaderContext ) {
142- const { resourcePath , rootContext } = loaderContext;
143- const relativePath = path .relative (rootContext, resourcePath);
144- if (
145- relativePath .replace (/ \\ / g , " /" ) !== " src/styles/variables.scss"
146- ) {
147- return ' @import "~@/styles/variables.scss";' + content;
148- }
149- return content;
150- },
151-
138+ additionalData: ` @import "~@/variables.scss";`
152139 },
153140 // 给 less-loader 传递 Less.js 相关选项
154141 less: {
You can’t perform that action at this time.
0 commit comments