Open tschoartschi opened 7 years ago
@rickharrison any update on this issue? Do you need more information or is the issue report fine?
Same problem here:
I want to include source map files of an external lib into my production build. I am including the .js file dynamically in index.html. I do not want to import it with app.import(..).
So in ember-cli-build.js I am including a funnel with file name xyz.js.map. Fingerprinting is enabled. After ember build, the source map reference in the xyz.js to the source map file xyz.js.map has been changed to: xyz-[hashvalue].js-[hashvalue].map
Correct would be in my opinion: xyz.js-[hashvalue].map
I guess the hash value is appended to every match on the defined fingerprinting file extensions (e.g. ['js', 'map']? The file extension matching should only match the extension part after the last dot. Today it seems to match every occurrence in the file/url.
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 whenbroccoli-asset-rewrite
rewrites the path to files which are generated by emscripten.In my
public
folder there is another folder which is calledassets
and there is a folderemscripten
. 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 toassets/emscripten/emscripten-e9b1f2eed90901137ae71b1fa2427717.js.mem
but the filename is stillemscripten.js.mem
. When I add the.mem
extension to be fingerprinted inember-cli-build.js
then the path is rewritten toassets/emscripten/emscripten-93c4916db6cd46010fdec63ab09a2118.js-2de574db8bcd561db3c5f8221f2abd73.mem
but the mem file is namedemscripten.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 inbroccoli-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 inemscripten.js
inmemoryInitializer
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/releasesMaybe 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
: