ember-cli / ember-cli/broccoli-asset-rev

JSON file with same name as JS file is fingerprinted in code but not on disk, if 'json' not in extensions to process

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
86
Forks
79
PR merge metrics
No merged PRs in 30d

Description

Repro steps:

```
npm install --save broccoli
npm install --save broccoli-asset-rev
mkdir app
echo "hello" > app/test.js
echo "there" > app.test.json
```

Create `app/index.html` containing

```

<script src="test.json">
```

Create Brocfile.js containing:

```
var AssetRev = require('broccoli-asset-rev');
var assetNode = new AssetRev('app', {});
module.exports = assetNode;
```

Run `broccoli build dist`

Now, look in the 'dist' folder. It contains

``` index.html
test-b1946ac92492d2347c6235b4d2611184.js
test.json
```

so you can see that test.js has been fingerprinted, and test.json has not. This is reasonable, the default file extensions for broccoli-asset-rev contains "js" but not "json".

Now look inside `dist/index.html`. It contains:

```
<script src="test-b1946ac92492d2347c6235b4d2611184.js">
<script src="test-b1946ac92492d2347c6235b4d2611184.json">
```

Notice that it has replaced the reference to test.json with the same fingerprint that it used for test.js, even though a:test.json should have a different fingerprint as it has different contents, and b:the test.json file in the 'dist' folder didn't get renamed, so the reference shouldn't have changed.

If I add 'json' to the list of extensions to process in the options, then it starts to work properly.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.