diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6c762..500dd11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [1.2.3](https://github.com/webpack/loader-utils/compare/v1.2.2...v1.2.3) (2018-12-27) + + +### Bug Fixes + +* **interpolateName:** don't interpolated `hashType` without `hash` or `contenthash` ([#140](https://github.com/webpack/loader-utils/issues/140)) ([3528fd9](https://github.com/webpack/loader-utils/commit/3528fd9)) + + + ## [1.2.2](https://github.com/webpack/loader-utils/compare/v1.2.1...v1.2.2) (2018-12-27) diff --git a/lib/interpolateName.js b/lib/interpolateName.js index cfe2ec0..d1fa661 100644 --- a/lib/interpolateName.js +++ b/lib/interpolateName.js @@ -91,7 +91,7 @@ function interpolateName(loaderContext, name, options) { // `hash` and `contenthash` are same in `loader-utils` context // let's keep `hash` for backward compatibility .replace( - /\[(?:([^:\]]+):)?(?:hash||contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi, + /\[(?:([^:\]]+):)?(?:hash|contenthash)(?::([a-z]+\d*))?(?::(\d+))?\]/gi, (all, hashType, digestType, maxLength) => getHashDigest(content, hashType, digestType, parseInt(maxLength, 10)) ) diff --git a/package.json b/package.json index 2a14883..30cc93c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "loader-utils", - "version": "1.2.2", + "version": "1.2.3", "author": "Tobias Koppers @sokra", "description": "utils for webpack loaders", "dependencies": { diff --git a/test/interpolateName.test.js b/test/interpolateName.test.js index 05b59f7..e57443a 100644 --- a/test/interpolateName.test.js +++ b/test/interpolateName.test.js @@ -124,6 +124,13 @@ describe('interpolateName()', () => { 'test content', 'modal.1n8osQznuT8jOAwdzg_n.css', ], + // Should not interpret without `hash` or `contenthash` + [ + '/lib/components/modal/modal.css', + '[name].[md5::base64:20].[ext]', + 'test content', + 'modal.[md5::base64:20].css', + ], ].forEach((test) => { it('should interpolate ' + test[0] + ' ' + test[1], () => { const interpolatedName = loaderUtils.interpolateName(