Skip to content

Commit 36f9f1f

Browse files
committed
feat: upgrade sass-loader support to ^8
1 parent 134f47a commit 36f9f1f

File tree

6 files changed

+36
-24
lines changed

6 files changed

+36
-24
lines changed

lib/loaders/sass.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ module.exports = {
4242
const config = Object.assign({}, {
4343
// needed by the resolve-url-loader
4444
sourceMap: (true === webpackConfig.sassOptions.resolveUrlLoader) || webpackConfig.useSourceMaps,
45-
// CSS minification is handled with mini-css-extract-plugin
46-
outputStyle: 'expanded'
45+
sassOptions: {
46+
// CSS minification is handled with mini-css-extract-plugin
47+
outputStyle: 'expanded'
48+
}
4749
});
4850

4951
sassLoaders.push({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"preact": "^8.2.1",
8585
"preact-compat": "^3.17.0",
8686
"sass": "^1.17.0",
87-
"sass-loader": "^7.0.1",
87+
"sass-loader": "^8.0.0",
8888
"sinon": "^2.3.4",
8989
"strip-ansi": "^5.0.0",
9090
"stylus": "^0.54.5",

test/WebpackConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ describe('WebpackConfig object', () => {
842842

843843
it('Pass options callback', () => {
844844
const config = createConfig();
845-
const callback = (sassOptions) => {};
845+
const callback = (options) => {};
846846
config.enableSassLoader(callback);
847847

848848
expect(config.sassLoaderOptionsCallback).to.equal(callback);

test/loaders/sass.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,20 @@ describe('loaders/sass', () => {
111111
sinon.stub(cssLoader, 'getLoaders')
112112
.callsFake(() => []);
113113

114-
config.enableSassLoader(function(sassOptions) {
115-
sassOptions.custom_optiona = 'baz';
116-
sassOptions.other_option = true;
114+
config.enableSassLoader(function(options) {
115+
options.sassOptions.custom_optiona = 'baz';
116+
options.sassOptions.other_option = true;
117117
});
118118

119119
const actualLoaders = sassLoader.getLoaders(config);
120120

121121
expect(actualLoaders[1].options).to.deep.equals({
122122
sourceMap: true,
123-
outputStyle: 'expanded',
124-
custom_optiona: 'baz',
125-
other_option: true
123+
sassOptions: {
124+
outputStyle: 'expanded',
125+
custom_optiona: 'baz',
126+
other_option: true
127+
}
126128
});
127129
cssLoader.getLoaders.restore();
128130
});
@@ -134,8 +136,8 @@ describe('loaders/sass', () => {
134136
sinon.stub(cssLoader, 'getLoaders')
135137
.callsFake(() => []);
136138

137-
config.enableSassLoader(function(sassOptions) {
138-
sassOptions.custom_option = 'baz';
139+
config.enableSassLoader(function(options) {
140+
options.custom_option = 'baz';
139141

140142
// This should override the original config
141143
return { foo: true };

test/package-helper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('package-helper', () => {
123123
describe('The getInvalidPackageVersionRecommendations correctly checks installed versions', () => {
124124
it('Check package that *is* the correct version', () => {
125125
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
126-
{ name: 'sass-loader', version: '^7.0.1' },
126+
{ name: 'sass-loader', version: '^8.0.2' },
127127
{ name: 'preact', version: '^8.1.0' }
128128
]);
129129

@@ -132,17 +132,17 @@ describe('package-helper', () => {
132132

133133
it('Check package with a version too low', () => {
134134
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
135-
{ name: 'sass-loader', version: '^8.0.1' },
135+
{ name: 'sass-loader', version: '^9.0.0' },
136136
{ name: 'preact', version: '9.0.0' }
137137
]);
138138

139139
expect(versionProblems).to.have.length(2);
140140
expect(versionProblems[0]).to.contain('is too old');
141141
});
142142

143-
it('Check package with a version too low', () => {
143+
it('Check package with a version too new', () => {
144144
const versionProblems = packageHelper.getInvalidPackageVersionRecommendations([
145-
{ name: 'sass-loader', version: '^6.9.11' },
145+
{ name: 'sass-loader', version: '^7.0.1' },
146146
{ name: 'preact', version: '7.0.0' }
147147
]);
148148

yarn.lock

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5134,7 +5134,7 @@ [email protected]:
51345134
emojis-list "^2.0.0"
51355135
json5 "^1.0.1"
51365136

5137-
loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
5137+
loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
51385138
version "1.4.0"
51395139
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
51405140
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
@@ -7357,15 +7357,15 @@ sass-graph@^2.2.4:
73577357
scss-tokenizer "^0.2.3"
73587358
yargs "^7.0.0"
73597359

7360-
sass-loader@^7.0.1:
7361-
version "7.3.1"
7362-
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-7.3.1.tgz#a5bf68a04bcea1c13ff842d747150f7ab7d0d23f"
7363-
integrity sha512-tuU7+zm0pTCynKYHpdqaPpe+MMTQ76I9TPZ7i4/5dZsigE350shQWe5EZNl5dBidM49TPET75tNqRbcsUZWeNA==
7360+
sass-loader@^8.0.0:
7361+
version "8.0.2"
7362+
resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-8.0.2.tgz#debecd8c3ce243c76454f2e8290482150380090d"
7363+
integrity sha512-7o4dbSK8/Ol2KflEmSco4jTjQoV988bM82P9CZdmo9hR3RLnvNc0ufMNdMrB0caq38JQ/FgF4/7RcbcfKzxoFQ==
73647364
dependencies:
73657365
clone-deep "^4.0.1"
7366-
loader-utils "^1.0.1"
7367-
neo-async "^2.5.0"
7368-
pify "^4.0.1"
7366+
loader-utils "^1.2.3"
7367+
neo-async "^2.6.1"
7368+
schema-utils "^2.6.1"
73697369
semver "^6.3.0"
73707370

73717371
sass@^1.17.0:
@@ -7389,6 +7389,14 @@ schema-utils@^1.0.0:
73897389
ajv-errors "^1.0.0"
73907390
ajv-keywords "^3.1.0"
73917391

7392+
schema-utils@^2.6.1:
7393+
version "2.6.6"
7394+
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.6.tgz#299fe6bd4a3365dc23d99fd446caff8f1d6c330c"
7395+
integrity sha512-wHutF/WPSbIi9x6ctjGGk2Hvl0VOz5l3EKEuKbjPlB30mKZUzb9A5k9yEXRX3pwyqVLPvpfZZEllaFq/M718hA==
7396+
dependencies:
7397+
ajv "^6.12.0"
7398+
ajv-keywords "^3.4.1"
7399+
73927400
schema-utils@^2.6.5:
73937401
version "2.6.5"
73947402
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a"

0 commit comments

Comments
 (0)