Skip to content

Commit c711516

Browse files
authored
feat!: bump default sass-loader version to v10, drop sass-loader v7 support (#6187)
1 parent 637414c commit c711516

File tree

6 files changed

+27
-65
lines changed

6 files changed

+27
-65
lines changed

docs/migrations/migrate-from-v4.md

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Though both work in all our tests, please be aware that the `module-alias` appro
7575
#### Underlying Loaders and Plugins
7676

7777
* `html-webpack-plugin` is upgraded from v3 to v4, see more details in the [release announcement](https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d).
78+
* `sass-loader` v7 support is dropped. See the v8 breaking changes at its [changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md#800-2019-08-29).
7879
* `postcss-loader` is upgraded from v3 to v4. Most notably, `PostCSS` options (`plugin` / `syntax` / `parser` / `stringifier`) are moved into the `postcssOptions` field. More details available at the [changelog](https://github.com/webpack-contrib/postcss-loader/blob/master/CHANGELOG.md#400-2020-09-07).
7980
* `copy-webpack-plugin` is upgraded from v5 to v6. If you never customized its config through `config.plugin('copy')`, there should be no user-facing breaking changes. A full list of breaking changes is available at [`copy-webpack-plugin` v6.0.0 release](https://github.com/webpack-contrib/copy-webpack-plugin/releases/tag/v6.0.0).
8081
* `file-loader` is upgraded from v4 to v6, and `url-loader` from v2 to v4. The `esModule` option is now turned on by default for non-Vue-2 projects. Full changelog available at [`file-loader` changelog](https://github.com/webpack-contrib/file-loader/blob/master/CHANGELOG.md) and [`url-loader` changelog](https://github.com/webpack-contrib/url-loader/blob/master/CHANGELOG.md)

packages/@vue/cli-service/__tests__/css.spec.js

-6
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,3 @@ test('scss loaderOptions', () => {
387387
// should not merge scss options into default sass config
388388
expect(findOptions(config, 'sass', 'sass')).not.toHaveProperty('webpackImporter')
389389
})
390-
391-
test('should use dart sass implementation whenever possible', () => {
392-
const config = genConfig()
393-
expect(findOptions(config, 'scss', 'sass')).toMatchObject({ implementation: require('sass') })
394-
expect(findOptions(config, 'sass', 'sass')).toMatchObject({ implementation: require('sass') })
395-
})

packages/@vue/cli-service/generator/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ module.exports = (api, options) => {
3939
const deps = {
4040
sass: {
4141
sass: '^1.30.0',
42-
'sass-loader': '^8.0.2'
42+
'sass-loader': '^10.1.0'
4343
},
4444
'dart-sass': {
4545
sass: '^1.30.0',
46-
'sass-loader': '^8.0.2'
46+
'sass-loader': '^10.1.0'
4747
},
4848
less: {
4949
'less': '^3.0.4',

packages/@vue/cli-service/lib/config/css.js

+13-46
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const fs = require('fs')
22
const path = require('path')
3-
const { semver, warn, pauseSpinner, resumeSpinner } = require('@vue/cli-shared-utils')
43

54
const findExisting = (context, files) => {
65
for (const file of files) {
@@ -16,25 +15,6 @@ module.exports = (api, rootOptions) => {
1615
const shadowMode = !!process.env.VUE_CLI_CSS_SHADOW_MODE
1716
const isProd = process.env.NODE_ENV === 'production'
1817

19-
let sassLoaderVersion
20-
try {
21-
sassLoaderVersion = semver.major(require('sass-loader/package.json').version)
22-
} catch (e) {}
23-
if (sassLoaderVersion < 8) {
24-
pauseSpinner()
25-
warn('A new version of sass-loader is available. Please upgrade for best experience.')
26-
resumeSpinner()
27-
}
28-
29-
const defaultSassLoaderOptions = {}
30-
try {
31-
defaultSassLoaderOptions.implementation = require('sass')
32-
// since sass-loader 8, fibers will be automatically detected and used
33-
if (sassLoaderVersion < 8) {
34-
defaultSassLoaderOptions.fiber = require('fibers')
35-
}
36-
} catch (e) {}
37-
3818
const {
3919
extract = isProd,
4020
sourceMap = false,
@@ -205,34 +185,21 @@ module.exports = (api, rootOptions) => {
205185
createCSSRule('postcss', /\.p(ost)?css$/)
206186
createCSSRule('scss', /\.scss$/, 'sass-loader', Object.assign(
207187
{},
208-
defaultSassLoaderOptions,
209188
loaderOptions.scss || loaderOptions.sass
210189
))
211-
if (sassLoaderVersion < 8) {
212-
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign(
213-
{},
214-
defaultSassLoaderOptions,
215-
{
216-
indentedSyntax: true
217-
},
218-
loaderOptions.sass
219-
))
220-
} else {
221-
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign(
222-
{},
223-
defaultSassLoaderOptions,
224-
loaderOptions.sass,
225-
{
226-
sassOptions: Object.assign(
227-
{},
228-
loaderOptions.sass && loaderOptions.sass.sassOptions,
229-
{
230-
indentedSyntax: true
231-
}
232-
)
233-
}
234-
))
235-
}
190+
createCSSRule('sass', /\.sass$/, 'sass-loader', Object.assign(
191+
{},
192+
loaderOptions.sass,
193+
{
194+
sassOptions: Object.assign(
195+
{},
196+
loaderOptions.sass && loaderOptions.sass.sassOptions,
197+
{
198+
indentedSyntax: true
199+
}
200+
)
201+
}
202+
))
236203
createCSSRule('less', /\.less$/, 'less-loader', loaderOptions.less)
237204
createCSSRule('stylus', /\.styl(us)?$/, 'stylus-loader', loaderOptions.stylus)
238205

packages/@vue/cli-service/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"devDependencies": {
112112
"fibers": ">= 3.1.1 <6.0.0",
113113
"sass": "^1.30.0",
114-
"sass-loader": "^8.0.2",
114+
"sass-loader": "^10.1.0",
115115
"stylus-loader": "^4.3.1",
116116
"vue": "^2.6.12",
117117
"vue-router": "^3.4.3",

yarn.lock

+10-10
Original file line numberDiff line numberDiff line change
@@ -18733,16 +18733,16 @@ sane@^4.0.3:
1873318733
minimist "^1.1.1"
1873418734
walker "~1.0.5"
1873518735

18736-
sass-loader@^8.0.2:
18737-
version "8.0.2"
18738-
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-8.0.2.tgz#debecd8c3ce243c76454f2e8290482150380090d"
18739-
integrity sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==
18736+
sass-loader@^10.1.0:
18737+
version "10.1.0"
18738+
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-10.1.0.tgz#1727fcc0c32ab3eb197cda61d78adf4e9174a4b3"
18739+
integrity sha512-ZCKAlczLBbFd3aGAhowpYEy69Te3Z68cg8bnHHl6WnSCvnKpbM6pQrz957HWMa8LKVuhnD9uMplmMAHwGQtHeg==
1874018740
dependencies:
18741-
clone-deep "^4.0.1"
18742-
loader-utils "^1.2.3"
18743-
neo-async "^2.6.1"
18744-
schema-utils "^2.6.1"
18745-
semver "^6.3.0"
18741+
klona "^2.0.4"
18742+
loader-utils "^2.0.0"
18743+
neo-async "^2.6.2"
18744+
schema-utils "^3.0.0"
18745+
semver "^7.3.2"
1874618746

1874718747
sass@^1.30.0:
1874818748
version "1.30.0"
@@ -18801,7 +18801,7 @@ schema-utils@^1.0.0:
1880118801
ajv-errors "^1.0.0"
1880218802
ajv-keywords "^3.1.0"
1880318803

18804-
schema-utils@^2.0.0, schema-utils@^2.6.1, schema-utils@^2.6.5, schema-utils@^2.7.0:
18804+
schema-utils@^2.0.0, schema-utils@^2.6.5, schema-utils@^2.7.0:
1880518805
version "2.7.1"
1880618806
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.7.1.tgz#1ca4f32d1b24c590c203b8e7a50bf0ea4cd394d7"
1880718807
integrity sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==

0 commit comments

Comments
 (0)