Convert image URLs in React to require
calls
This allows Webpack to insert the proper image URL after builds steps like adding a hash and so on. The path you supply to `require` is relative to the JS source file, just like any other would be.
This commit is contained in:
parent
989227d435
commit
20e296b20e
75 changed files with 201 additions and 176 deletions
|
@ -160,7 +160,7 @@ const EntityTile = React.createClass({
|
|||
if (this.props.showInviteButton) {
|
||||
inviteButton = (
|
||||
<div className="mx_EntityTile_invite">
|
||||
<img src="img/plus.svg" width="16" height="16" />
|
||||
<img src={require("../../../../res/img/plus.svg")} width="16" height="16" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ const EntityTile = React.createClass({
|
|||
const powerStatus = this.props.powerStatus;
|
||||
if (powerStatus) {
|
||||
const src = {
|
||||
[EntityTile.POWER_STATUS_MODERATOR]: "img/mod.svg",
|
||||
[EntityTile.POWER_STATUS_ADMIN]: "img/admin.svg",
|
||||
[EntityTile.POWER_STATUS_MODERATOR]: require("../../../../res/img/mod.svg"),
|
||||
[EntityTile.POWER_STATUS_ADMIN]: require("../../../../res/img/admin.svg"),
|
||||
}[powerStatus];
|
||||
const alt = {
|
||||
[EntityTile.POWER_STATUS_MODERATOR]: _t("Moderator"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue