Skip to content

Commit

Permalink
Show warning for missing <meta> tag
Browse files Browse the repository at this point in the history
When the ember-cli-storybook addon is used there is no meta tag since it is currently generating a different HTML file that does not contain it. While it is okay for ember-cli-ifa to not work correctly in those cases we shouldn't crash the app, but instead show a warning indicating that the addon might not work as expected. Since fingerprinting and ember-cli-ifa are usually only enabled in production builds and ember-cli-storybook is aimed more at development builds that seems like a reasonable tradeoff until ember-cli-storybook can fix how it builds the HTML file.
  • Loading branch information
Turbo87 committed Nov 27, 2019
1 parent 3deb1f3 commit e0512e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addon/utils/get-asset-map-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ export default function getAssetMapData() {
return assetMap.default;
}

const assetMapString = document.querySelector("meta[name='ember-cli-ifa:assetMap']").content;
let metaTag = document.querySelector("meta[name='ember-cli-ifa:assetMap']");
if (!metaTag) {
console.warn('<meta name="ember-cli-ifa:assetMap"> tag is missing.');
}

const assetMapString = metaTag.content;
if (!assetMapString) {
return;
}
Expand Down

0 comments on commit e0512e4

Please sign in to comment.