Skip to content

Commit

Permalink
feat: allow using webpack defines to override the dir that the native…
Browse files Browse the repository at this point in the history
… modules are loaded from
  • Loading branch information
MarshallOfSound committed May 23, 2019
1 parent 53b7dce commit faa0af7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/asset-relocator.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ module.exports = async function (content, map) {
this.emitFile(assetBase(options) + name, source);
}
});
return "__dirname + '/" + relAssetPath(this, options) + JSON.stringify(name).slice(1, -1) + "'";
return "(typeof ASSET_RELOCATOR_BASE_DIR === 'undefined' ? __dirname : ASSET_RELOCATOR_BASE_DIR) + '/" + relAssetPath(this, options) + JSON.stringify(name).slice(1, -1) + "'";
};
const emitAssetDirectory = (wildcardPath, wildcards) => {
const wildcardIndex = wildcardPath.indexOf(WILDCARD);
Expand Down Expand Up @@ -403,7 +403,7 @@ module.exports = async function (content, map) {
assetExpressions += " + \'" + JSON.stringify(curPattern).slice(1, -1) + "'";
}
}
return "__dirname + '/" + relAssetPath(this, options) + JSON.stringify(name + firstPrefix).slice(1, -1) + "'" + assetExpressions;
return "(typeof ASSET_RELOCATOR_BASE_DIR === 'undefined' ? __dirname : ASSET_RELOCATOR_BASE_DIR) + '/" + relAssetPath(this, options) + JSON.stringify(name + firstPrefix).slice(1, -1) + "'" + assetExpressions;
};

let assetEmissionPromises = Promise.resolve();
Expand Down

1 comment on commit faa0af7

@Brli
Copy link

@Brli Brli commented on faa0af7 Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this ASSET_RELOCATOR_BASE_DIR variable not documented anywhere in electron-forge manual?

Please sign in to comment.