fix(asset): wideSVG is refusing to exist, use legacy loading mechanism

This commit is contained in:
Paul 2021-10-23 16:42:04 +01:00
parent 6595b7687a
commit 6e3905eb0f
5 changed files with 16 additions and 19 deletions

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -4,6 +4,7 @@ import styles from "./Onboarding.module.scss";
import { Text } from "preact-i18n"; import { Text } from "preact-i18n";
import { useState } from "preact/hooks"; import { useState } from "preact/hooks";
import wideSVG from "../../../../public/assets/wide.svg";
import Button from "../../../components/ui/Button"; import Button from "../../../components/ui/Button";
import Preloader from "../../../components/ui/Preloader"; import Preloader from "../../../components/ui/Preloader";
@ -40,7 +41,7 @@ export function OnboardingModal({ onClose, callback }: Props) {
<h1> <h1>
<Text id="app.special.modals.onboarding.welcome" /> <Text id="app.special.modals.onboarding.welcome" />
<br /> <br />
<img src={"/assets/svg/wide.svg"} loading="eager" /> <img src={wideSVG} loading="eager" />
</h1> </h1>
</div> </div>
<div className={styles.form}> <div className={styles.form}>

View file

@ -10,6 +10,7 @@ import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
import { dispatch, getState } from "../../redux"; import { dispatch, getState } from "../../redux";
import wideSVG from "../../../../public/assets/wide.svg";
import Emoji from "../../components/common/Emoji"; import Emoji from "../../components/common/Emoji";
import Tooltip from "../../components/common/Tooltip"; import Tooltip from "../../components/common/Tooltip";
import Header from "../../components/ui/Header"; import Header from "../../components/ui/Header";
@ -66,7 +67,7 @@ export default function Home() {
<h3> <h3>
<Text id="app.special.modals.onboarding.welcome" /> <Text id="app.special.modals.onboarding.welcome" />
<br /> <br />
<img src={"/assets/svg/wide.svg"} /> <img src={wideSVG} />
</h3> </h3>
<div className={styles.actions}> <div className={styles.actions}>
<Link to="/invite/Testers"> <Link to="/invite/Testers">

View file

@ -9,6 +9,7 @@ import { useContext, useState } from "preact/hooks";
import { AppContext } from "../../../context/revoltjs/RevoltClient"; import { AppContext } from "../../../context/revoltjs/RevoltClient";
import { takeError } from "../../../context/revoltjs/util"; import { takeError } from "../../../context/revoltjs/util";
import wideSVG from "../../../../public/assets/wide.svg";
import Button from "../../../components/ui/Button"; import Button from "../../../components/ui/Button";
import Overline from "../../../components/ui/Overline"; import Overline from "../../../components/ui/Overline";
import Preloader from "../../../components/ui/Preloader"; import Preloader from "../../../components/ui/Preloader";
@ -145,7 +146,7 @@ export function Form({ page, callback }: Props) {
return ( return (
<div className={styles.form}> <div className={styles.form}>
<img src={"/assets/svg/wide.svg"} /> <img src={wideSVG} />
{/* Preact / React typing incompatabilities */} {/* Preact / React typing incompatabilities */}
<form <form
onSubmit={ onSubmit={

View file

@ -11,11 +11,11 @@ function getGitRevision() {
const rev = readFileSync(".git/HEAD").toString().trim(); const rev = readFileSync(".git/HEAD").toString().trim();
if (rev.indexOf(":") === -1) { if (rev.indexOf(":") === -1) {
return rev; return rev;
} else { }
return readFileSync(".git/" + rev.substring(5))
return readFileSync(`.git/${rev.substring(5)}`)
.toString() .toString()
.trim(); .trim();
}
} catch (err) { } catch (err) {
console.error("Failed to get Git revision."); console.error("Failed to get Git revision.");
return "?"; return "?";
@ -27,9 +27,9 @@ function getGitBranch() {
const rev = readFileSync(".git/HEAD").toString().trim(); const rev = readFileSync(".git/HEAD").toString().trim();
if (rev.indexOf(":") === -1) { if (rev.indexOf(":") === -1) {
return "DETACHED"; return "DETACHED";
} else {
return rev.split("/").pop();
} }
return rev.split("/").pop();
} catch (err) { } catch (err) {
console.error("Failed to get Git branch."); console.error("Failed to get Git branch.");
return "?"; return "?";
@ -40,10 +40,6 @@ function getVersion() {
return readFileSync("VERSION").toString(); return readFileSync("VERSION").toString();
} }
const branch = getGitBranch();
const isNightly = false; //branch !== 'production';
const iconPrefix = isNightly ? "nightly-" : "";
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
preact(), preact(),
@ -52,11 +48,9 @@ export default defineConfig({
filename: "sw.ts", filename: "sw.ts",
strategies: "injectManifest", strategies: "injectManifest",
manifest: { manifest: {
name: isNightly ? "Revolt Nightly" : "Revolt", name: "Revolt",
short_name: "Revolt", short_name: "Revolt",
description: isNightly description: "User-first, privacy-focused chat platform.",
? "Early preview builds of Revolt."
: "User-first, privacy-focused chat platform.",
categories: ["messaging"], categories: ["messaging"],
start_url: "/", start_url: "/",
orientation: "portrait", orientation: "portrait",
@ -65,12 +59,12 @@ export default defineConfig({
theme_color: "#101823", theme_color: "#101823",
icons: [ icons: [
{ {
src: `/assets/icons/${iconPrefix}android-chrome-192x192.png`, src: `/assets/icons/android-chrome-192x192.png`,
type: "image/png", type: "image/png",
sizes: "192x192", sizes: "192x192",
}, },
{ {
src: `/assets/icons/${iconPrefix}android-chrome-512x512.png`, src: `/assets/icons/android-chrome-512x512.png`,
type: "image/png", type: "image/png",
sizes: "512x512", sizes: "512x512",
}, },