Skip to content

Commit 63ed3e9

Browse files
committed
Revert "Avoid check old webpack versions (#66)"
This reverts commit 91d097e. This allows this commit to go into v2.0.0.
1 parent 3f8b4d6 commit 63ed3e9

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Change Log
22
## [Unreleased]
3+
## [1.3.5] - 2018-11-05
4+
* Reverts commit for 1.3.4 to avoid breaking change users of webpack v1. [#81](https://github.com/shakacode/sass-resources-loader/pull/81) by [justin808](https://github.com/justin808)
35

46
## [1.3.4] - 2018-10-14
57
* Supports Webpack 4 and removed support for Webpack v1
@@ -17,7 +19,8 @@
1719

1820
For other releases see [GitHub Releases section](https://github.com/shakacode/sass-resources-loader/releases).
1921

20-
[Unreleased]: https://github.com/shakacode/sass-resources-loader/compare/v1.3.4...master
22+
[Unreleased]: https://github.com/shakacode/sass-resources-loader/compare/v1.3.5...master
23+
[1.3.5]: https://github.com/shakacode/sass-resources-loader/compare/v1.3.4...v1.3.5
2124
[1.3.4]: https://github.com/shakacode/sass-resources-loader/compare/v1.3.3...v1.3.4
2225
[1.3.3]: https://github.com/shakacode/sass-resources-loader/compare/v1.3.0...v1.3.3
2326
[1.3.0]: https://github.com/shakacode/sass-resources-loader/compare/v1.2.0...v1.3.0

src/loader.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ module.exports = function(source) {
2121

2222
logger.debug(`Hey, we're in DEBUG mode! Yabba dabba doo!`);
2323

24-
const resourcesFromConfig = (loaderUtils.getOptions(this) || {}).resources;
24+
// TODO: Remove `webpack.options.sassResources` support after first stable webpack@2 release
25+
const isModernWebpack = webpack.version >= 2;
26+
const resourcesFromConfig =
27+
isModernWebpack
28+
? (loaderUtils.getOptions(this) || {}).resources
29+
: webpack.options.sassResources;
2530

2631
if (!resourcesFromConfig) {
27-
const error = new Error('Can\'t find sass resources in your config. Make sure loader.options.resources exists');
32+
const error = new Error(`
33+
Can't find sass resources in your config.
34+
Make sure ${isModernWebpack ? 'loader.options.resources' : 'webpackConfig.sassResources'} exists.
35+
`);
2836

2937
return callback(error);
3038
}

test/index.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ describe(`sass-resources-loader`, () => {
8787
}],
8888
},
8989
}, (err) => {
90-
expect(err.message).toMatch(/Can\'t find sass resources in your config. Make sure loader.options.resources exists/);
90+
expect(err.message).toMatch(/Can\'t find sass resources in your config/);
91+
expect(err.message).toMatch(/Make sure loader.options.resources exists/);
9192
done();
9293
});
9394
});

0 commit comments

Comments
 (0)