ember-cli / broccoli-asset-rev

Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
MIT License
87 stars 84 forks source link

assetMap is rewritten if "json" is in replaceExtensions #91

Open tomdale opened 8 years ago

tomdale commented 8 years ago

Just ran into a tough-to-debug issue with broccoli-asset-rev that was causing issues in FastBoot. FastBoot relies on the asset map to generate its own manifest file.

However, in one of the apps I'm working on, they had added json to the replaceExtensions array (which I'd guess may be fairly common). Unfortunately, the assetMap.json file is also rewritten.

In effect, that means that instead of:

{ assets: 
   { 'assets/module-whitelist.css': 'assets/module-whitelist-d41d8cd98f00b204e9800998ecf8427e.css',
     'assets/module-whitelist.js': 'assets/module-whitelist-b2b974ffee53efecae932353853cf83a.js',
     'assets/vendor.css': 'assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css',
     'assets/vendor.js': 'assets/vendor-eb3d3e03fa845747687b14602e40e459.js' },
  prepend: 'http://cdn.example.com/' }

You instead get the prepended URL added to each path:

{ assets: 
   { 'http://cdn.example.com/assets/module-whitelist.css': 'assets/module-whitelist-d41d8cd98f00b204e9800998ecf8427e.css',
     'http://cdn.example.com/assets/module-whitelist.js': 'assets/module-whitelist-b2b974ffee53efecae932353853cf83a.js',
     'http://cdn.example.com/assets/vendor.css': 'assets/vendor-d41d8cd98f00b204e9800998ecf8427e.css',
     'http://cdn.example.com/assets/vendor.js': 'assets/vendor-eb3d3e03fa845747687b14602e40e459.js' },
  prepend: 'http://cdn.example.com/' }
rickharrison commented 8 years ago

Thanks for reporting. Can you add assetMap.json to the exclude property to fix this?

tomdale commented 8 years ago

@rickharrison We just removed json from replaceExtensions since it was no longer needed (it was left over from using fixture data that had since been moved to talking to an API server). That's a good idea, though—and perhaps adding the assetMapPath to exclude by default could be a nice improvement.

teddyzeenny commented 7 years ago

@rickharrison wouldn't adding assetMap.json to exclude only avoid fingerprinting the file itself but not the assets inside it? I'm able to use exclude to cancel files matched by the extensions option (they don't get fingerprinted themselves) but not the ones matched by replaceExtensions (the assets inside them still get fingerprinted).

[EDIT]: I noticed there's an ignore option for this.