Skip to content

Commit bd1f1b7

Browse files
authored
chore!: remove deprecated node-sass (#6090)
1 parent 6c3f118 commit bd1f1b7

File tree

9 files changed

+4
-31
lines changed

9 files changed

+4
-31
lines changed

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

-9
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ test('sass (default)', async () => {
1919
expect(pkg).toHaveProperty(['devDependencies', 'sass'])
2020
})
2121

22-
test('node sass', async () => {
23-
const { pkg, files } = await generateWithOptions({
24-
cssPreprocessor: 'node-sass'
25-
})
26-
27-
expect(files['src/App.vue']).toMatch('<style lang="scss">')
28-
expect(pkg).toHaveProperty(['devDependencies', 'node-sass'])
29-
})
30-
3122
test('dart sass', async () => {
3223
const { pkg, files } = await generateWithOptions({
3324
cssPreprocessor: 'dart-sass'

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

-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ module.exports = (api, options) => {
4141
sass: '^1.26.5',
4242
'sass-loader': '^8.0.2'
4343
},
44-
'node-sass': {
45-
'node-sass': '^4.12.0',
46-
'sass-loader': '^8.0.2'
47-
},
4844
'dart-sass': {
4945
sass: '^1.26.5',
5046
'sass-loader': '^8.0.2'

packages/@vue/cli/lib/options.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const presetSchema = createSchema((joi) =>
4343
}),
4444
cssPreprocessor: joi
4545
.string()
46-
.valid('sass', 'dart-sass', 'node-sass', 'less', 'stylus'),
46+
.valid('sass', 'dart-sass', 'less', 'stylus'),
4747
plugins: joi.object().required(),
4848
configs: joi.object()
4949
})

packages/@vue/cli/lib/promptModules/__tests__/cssPreprocessors.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test('CSS pre-processor ', async () => {
1414
},
1515
{
1616
message: 'Pick a CSS pre-processor',
17-
choices: ['Sass/SCSS (with dart-sass)', 'Sass/SCSS (with node-sass)', 'Less', 'Stylus'],
17+
choices: ['Sass/SCSS (with dart-sass)', 'Less', 'Stylus'],
1818
choose: 0
1919
}
2020
]

packages/@vue/cli/lib/promptModules/cssPreprocessors.js

-8
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,10 @@ module.exports = cli => {
1515
message: `Pick a CSS pre-processor${process.env.VUE_CLI_API_MODE ? '' : ` (${notice})`}:`,
1616
description: `${notice}.`,
1717
choices: [
18-
// In Vue CLI <= 3.3, the value of Sass option in 'sass' an means 'node-sass'.
19-
// Considering the 'sass' package on NPM is actually for Dart Sass, we renamed it to 'node-sass'.
20-
// In @vue/cli-service there're still codes that accepts 'sass' as an option value, for compatibility reasons,
21-
// and they're meant to be removed in v4.
2218
{
2319
name: 'Sass/SCSS (with dart-sass)',
2420
value: 'dart-sass'
2521
},
26-
{
27-
name: 'Sass/SCSS (with node-sass)',
28-
value: 'node-sass'
29-
},
3022
{
3123
name: 'Less',
3224
value: 'less'

packages/@vue/cli/lib/util/ProjectPackageManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class PackageManager {
247247
}
248248

249249
try {
250-
// node-sass, chromedriver, etc.
250+
// chromedriver, etc.
251251
const binaryMirrorConfigMetadata = await this.getMetadata('binary-mirror-config', { full: true })
252252
const latest = binaryMirrorConfigMetadata['dist-tags'] && binaryMirrorConfigMetadata['dist-tags'].latest
253253
const mirrors = binaryMirrorConfigMetadata.versions[latest].mirrors.china

packages/@vue/cli/lib/util/inferRootOptions.js

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ module.exports = function inferRootOptions (pkg) {
3434
// cssPreprocessors
3535
if ('sass' in deps) {
3636
rootOptions.cssPreprocessor = 'sass'
37-
} else if ('node-sass' in deps) {
38-
rootOptions.cssPreprocessor = 'node-sass'
3937
} else if ('less-loader' in deps) {
4038
rootOptions.cssPreprocessor = 'less'
4139
} else if ('stylus-loader' in deps) {

packages/@vue/cli/types/cli-test.ts

-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ const testPromptAPI = (cli: PromptModuleAPI) => {
4444
name: 'Sass/SCSS (with dart-sass)',
4545
value: 'dart-sass'
4646
},
47-
{
48-
name: 'Sass/SCSS (with node-sass)',
49-
value: 'node-sass'
50-
},
5147
{
5248
name: 'Less',
5349
value: 'less'

packages/@vue/cli/types/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type Preset = Partial<{
4848
useConfigFiles: boolean
4949
plugins: Record<string, any>
5050
configs: Record<string, any>
51-
cssPreprocessor: 'sass' | 'dart-sass' | 'node-sass' | 'less' | 'stylus'
51+
cssPreprocessor: 'sass' | 'dart-sass' | 'less' | 'stylus'
5252
}>
5353

5454
declare class PromptModuleAPI {

0 commit comments

Comments
 (0)