Skip to content

Commit

Permalink
Merge pull request #176 from mansona/fix-placeholder
Browse files Browse the repository at this point in the history
Fix error - Inject empty meta tag when addon not enabled
  • Loading branch information
mansona authored Jun 10, 2020
2 parents 230fcc7 + cab1a90 commit e6e0ce2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,19 @@ module.exports = {
return;
}

if (!this._config().enabled) {
return '<meta name="ember-cli-ifa:assetMap">';
}

return `<meta name="ember-cli-ifa:assetMap" content="${MetaPlaceholder}">`;
},

/**
* By default, during runtime the asset-map service reads the asset map
* By default, during runtime, the asset-map service reads the asset map
* information from a meta tag on the index.html. As we do not have access to
* global `document` when running in fastboot, we need to implement a
* different way to access this asset-map information. See
* `get-asset-map-data` where we require the `asset-map` module taht is
* `get-asset-map-data` where we require the `asset-map` module that is
* generated in the postBuild() below.
*/
updateFastBootManifest(manifest) {
Expand All @@ -55,8 +59,7 @@ module.exports = {
postBuild(build) {
this._super.included.apply(this, arguments);

const env = process.env.EMBER_ENV;
const ifaConfig = this.project.config(env).ifa;
const ifaConfig = this._config();

if (!ifaConfig.enabled) {
return;
Expand Down Expand Up @@ -119,4 +122,9 @@ module.exports = {
replacePlaceholder(testIndexPath, assetMap);
}
},

_config() {
const env = process.env.EMBER_ENV;
return this.project.config(env).ifa;
},
};

0 comments on commit e6e0ce2

Please sign in to comment.