ember-cli / ember-cli/broccoli-asset-rewrite

Fingerprint is appended wrong if files have the same name but different extension

Open
#63 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I first posted this issue in Ember-Cli because I didn't know where to open this issue but after a discussion on Slack I think it better fits here. I just copy and paste it, the original issue is here (https://github.com/ember-cli/ember-cli/issues/7466).

When I build an Ember app with the production flag then the `broccoli-asset-rewrite` does a wrong rewrite of my assets. In my case this happens when `broccoli-asset-rewrite` rewrites the path to files which are generated by [emscripten](https://github.com/kripken/emscripten/wiki).

In my `public` folder there is another folder which is called `assets` and there is a folder `emscripten`. The build result of the emscripten is file called emscripten.js and a emscripten.js.mem file. In the emscripten.js file the path to the .mem file is specified like this: `var data = {memoryInitializer: 'assets/emscripten/emscripten.js.mem'};`. After fingerprinting the path is rewritten to `assets/emscripten/emscripten-e9b1f2eed90901137ae71b1fa2427717.js.mem` but the filename is still `emscripten.js.mem`. When I add the `.mem` extension to be fingerprinted in `ember-cli-build.js` then the path is rewritten to `assets/emscripten/emscripten-93c4916db6cd46010fdec63ab09a2118.js-2de574db8bcd561db3c5f8221f2abd73.mem` but the mem file is named `emscripten.js-2de574db8bcd561db3c5f8221f2abd73.mem`.

Right now we change the paths by hand, because adjusting the `emscripten build` is not that easy in our whole workflow. Would be great if there is a solution to this problem. I wanted to create some fix but I ended up at some mad regex in `broccoli-asset-rewrite` where I can not estimate the impact of a change. Furthermore I'm not sure if the bug really comes from there.

I created a repo which should demonstrate the issue:
https://github.com/tschoartschi/ember-cli-fingerprint-problem
To reproduce `ember build -e production` and check if the output in `emscripten.js` in `memoryInitializer` has the correct path to the mem file. I created two git tags, one with the fingerprinting settings I use and one without any settings. See: https://github.com/tschoartschi/ember-cli-fingerprint-problem/releases

Maybe this issue is related to https://github.com/ember-cli/ember-cli/issues/7149 because there the reporter also has the problems of two hashes in one filename

I also think this issue could be very similar to this one: https://github.com/rickharrison/broccoli-asset-rewrite/issues/57

Maybe also related to: https://github.com/rickharrison/broccoli-asset-rev/issues/94

---

Output from `ember version --verbose && npm --version && yarn --version`:
```
ember-cli: 2.16.2
http_parser: 2.7.0
node: 8.4.0
v8: 6.0.286.52
uv: 1.13.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.22.0
openssl: 1.0.2l
icu: 59.1
unicode: 9.0
cldr: 31.0.1
tz: 2017b
os: darwin x64
5.4.2
1.1.0
```

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.