Skip to content

Commit

Permalink
fix: Failed to replaces hash when loader is a actual file name.
Browse files Browse the repository at this point in the history
For example:
```html
<link rel="manifest" href="/manifest.json">
```
```
{
    test: /manifest.json$/,
    loader: 'file-loader',
    options: {
      name: `[name]-[hash:${fileHashLength}].[ext]`
    }
  }

new ReplaceHashWebpackPlugin({
    src: `**/*.html`,
    exts: ['js', 'css', 'png', 'json']
  })
```
  • Loading branch information
zhongzhi107 committed Jan 26, 2018
1 parent 91a2a54 commit a680db2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ReplaceHashPlugin.prototype.apply = function (compiler) {
break;
default:
compiler.options.module.rules.forEach(function(rule) {
if (rule.test.test(ext)) {
if (rule.test.toString().indexOf(ext) > -1) {
var query = rule.query || rule.options;
if (rule.use) {
rule.use.forEach(function(use) {
Expand Down

0 comments on commit a680db2

Please sign in to comment.