Compare commits
19 commits
fix_site_s
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b6415f828e | ||
![]() |
cc184a86c8 | ||
![]() |
2d88e42cab | ||
![]() |
9e7fec772d | ||
![]() |
df39e0fe5d | ||
![]() |
fa41117320 | ||
![]() |
d8ee0ec78a | ||
![]() |
fead020bdc | ||
![]() |
339cefa2b0 | ||
![]() |
08370d4c4e | ||
![]() |
b73cb808e4 | ||
![]() |
80d9aac1ca | ||
![]() |
751495702c | ||
![]() |
ad6db69dda | ||
![]() |
6bf159261a | ||
![]() |
73be96880a | ||
![]() |
dc439b8dee | ||
![]() |
ec649d1911 | ||
![]() |
eee1f443a8 |
20 changed files with 125 additions and 91 deletions
|
@ -2,3 +2,4 @@ src/shared/translations
|
||||||
lemmy-translations
|
lemmy-translations
|
||||||
src/assets/css/themes/*.css
|
src/assets/css/themes/*.css
|
||||||
stats.json
|
stats.json
|
||||||
|
dist
|
||||||
|
|
|
@ -27,7 +27,7 @@ COPY .git .git
|
||||||
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
|
RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts"
|
||||||
|
|
||||||
RUN yarn --production --prefer-offline
|
RUN yarn --production --prefer-offline
|
||||||
RUN yarn build:prod
|
RUN NODE_OPTIONS="--max-old-space-size=8192" yarn build:prod
|
||||||
|
|
||||||
# Prune the image
|
# Prune the image
|
||||||
RUN node-prune /usr/src/app/node_modules
|
RUN node-prune /usr/src/app/node_modules
|
||||||
|
|
|
@ -20,6 +20,7 @@ COPY generate_translations.js \
|
||||||
|
|
||||||
COPY lemmy-translations lemmy-translations
|
COPY lemmy-translations lemmy-translations
|
||||||
COPY src src
|
COPY src src
|
||||||
|
COPY .git .git
|
||||||
|
|
||||||
# Set UI version
|
# Set UI version
|
||||||
RUN echo "export const VERSION = 'dev';" > "src/shared/version.ts"
|
RUN echo "export const VERSION = 'dev';" > "src/shared/version.ts"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lemmy-ui",
|
"name": "lemmy-ui",
|
||||||
"version": "0.18.1-rc.3",
|
"version": "0.18.1-rc.5",
|
||||||
"description": "An isomorphic UI for lemmy",
|
"description": "An isomorphic UI for lemmy",
|
||||||
"repository": "https://github.com/LemmyNet/lemmy-ui",
|
"repository": "https://github.com/LemmyNet/lemmy-ui",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
|
@ -8,9 +8,9 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "webpack --mode=none",
|
"analyze": "webpack --mode=none",
|
||||||
"prebuild:dev": "yarn clean && node generate_translations.js",
|
"prebuild:dev": "yarn clean && node generate_translations.js",
|
||||||
"build:dev": "webpack --mode=development",
|
"build:dev": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=development",
|
||||||
"prebuild:prod": "yarn clean && node generate_translations.js",
|
"prebuild:prod": "yarn clean && node generate_translations.js",
|
||||||
"build:prod": "webpack --mode=production",
|
"build:prod": "webpack --env COMMIT_HASH=$(git rev-parse --short HEAD) --mode=production",
|
||||||
"clean": "yarn run rimraf dist",
|
"clean": "yarn run rimraf dist",
|
||||||
"dev": "yarn build:dev --watch",
|
"dev": "yarn build:dev --watch",
|
||||||
"lint": "yarn translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
|
"lint": "yarn translations:generate && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx \"src/**\" && prettier --check \"src/**/*.{ts,tsx,js,css,scss}\"",
|
||||||
|
@ -52,7 +52,6 @@
|
||||||
"cross-fetch": "^3.1.5",
|
"cross-fetch": "^3.1.5",
|
||||||
"css-loader": "^6.7.3",
|
"css-loader": "^6.7.3",
|
||||||
"date-fns": "^2.30.0",
|
"date-fns": "^2.30.0",
|
||||||
"date-fns-tz": "^2.0.0",
|
|
||||||
"emoji-mart": "^5.4.0",
|
"emoji-mart": "^5.4.0",
|
||||||
"emoji-short-name": "^2.0.0",
|
"emoji-short-name": "^2.0.0",
|
||||||
"express": "~4.18.2",
|
"express": "~4.18.2",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { setupDateFns } from "@utils/app";
|
import { setupDateFns } from "@utils/app";
|
||||||
|
import { getStaticDir } from "@utils/env";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
|
@ -19,7 +20,13 @@ const [hostname, port] = process.env["LEMMY_UI_HOST"]
|
||||||
|
|
||||||
server.use(express.json());
|
server.use(express.json());
|
||||||
server.use(express.urlencoded({ extended: false }));
|
server.use(express.urlencoded({ extended: false }));
|
||||||
server.use("/static", express.static(path.resolve("./dist")));
|
server.use(
|
||||||
|
getStaticDir(),
|
||||||
|
express.static(path.resolve("./dist"), {
|
||||||
|
maxAge: 24 * 60 * 60 * 1000, // 1 day
|
||||||
|
immutable: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
server.use(setCacheControl);
|
server.use(setCacheControl);
|
||||||
|
|
||||||
if (!process.env["LEMMY_UI_DISABLE_CSP"] && !process.env["LEMMY_UI_DEBUG"]) {
|
if (!process.env["LEMMY_UI_DISABLE_CSP"] && !process.env["LEMMY_UI_DEBUG"]) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { NextFunction, Response } from "express";
|
import type { NextFunction, Request, Response } from "express";
|
||||||
import { UserService } from "../shared/services";
|
import { UserService } from "../shared/services";
|
||||||
|
|
||||||
export function setDefaultCsp({
|
export function setDefaultCsp({
|
||||||
|
@ -18,24 +18,33 @@ export function setDefaultCsp({
|
||||||
|
|
||||||
// Set cache-control headers. If user is logged in, set `private` to prevent storing data in
|
// Set cache-control headers. If user is logged in, set `private` to prevent storing data in
|
||||||
// shared caches (eg nginx) and leaking of private data. If user is not logged in, allow caching
|
// shared caches (eg nginx) and leaking of private data. If user is not logged in, allow caching
|
||||||
// all responses for 60 seconds to reduce load on backend and database. The specific cache
|
// all responses for 5 seconds to reduce load on backend and database. The specific cache
|
||||||
// interval is rather arbitrary and could be set higher (less server load) or lower (fresher data).
|
// interval is rather arbitrary and could be set higher (less server load) or lower (fresher data).
|
||||||
//
|
//
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
||||||
export function setCacheControl({
|
export function setCacheControl(
|
||||||
res,
|
req: Request,
|
||||||
next,
|
res: Response,
|
||||||
}: {
|
next: NextFunction
|
||||||
res: Response;
|
) {
|
||||||
next: NextFunction;
|
|
||||||
}) {
|
|
||||||
const user = UserService.Instance;
|
const user = UserService.Instance;
|
||||||
let caching: string;
|
let caching: string;
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.NODE_ENV === "production" &&
|
||||||
|
(req.path.match(/\.(js|css|txt|manifest\.webmanifest)\/?$/) ||
|
||||||
|
req.path.includes("/css/themelist"))
|
||||||
|
) {
|
||||||
|
// Static content gets cached publicly for a day
|
||||||
|
caching = "public, max-age=86400";
|
||||||
|
} else {
|
||||||
if (user.auth()) {
|
if (user.auth()) {
|
||||||
caching = "private";
|
caching = "private";
|
||||||
} else {
|
} else {
|
||||||
caching = "public, max-age=60";
|
caching = "public, max-age=5";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res.setHeader("Cache-Control", caching);
|
res.setHeader("Cache-Control", caching);
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { getStaticDir } from "@utils/env";
|
||||||
import { Helmet } from "inferno-helmet";
|
import { Helmet } from "inferno-helmet";
|
||||||
import { renderToString } from "inferno-server";
|
import { renderToString } from "inferno-server";
|
||||||
import serialize from "serialize-javascript";
|
import serialize from "serialize-javascript";
|
||||||
|
@ -23,7 +24,7 @@ export async function createSsrHtml(
|
||||||
|
|
||||||
if (!appleTouchIcon) {
|
if (!appleTouchIcon) {
|
||||||
appleTouchIcon = site?.site_view.site.icon
|
appleTouchIcon = site?.site_view.site.icon
|
||||||
? `data:image/png;base64,${sharp(
|
? `data:image/png;base64,${await sharp(
|
||||||
await fetchIconPng(site.site_view.site.icon)
|
await fetchIconPng(site.site_view.site.icon)
|
||||||
)
|
)
|
||||||
.resize(180, 180)
|
.resize(180, 180)
|
||||||
|
@ -87,7 +88,7 @@ export async function createSsrHtml(
|
||||||
<link rel="apple-touch-startup-image" href=${appleTouchIcon} />
|
<link rel="apple-touch-startup-image" href=${appleTouchIcon} />
|
||||||
|
|
||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link rel="stylesheet" type="text/css" href="/static/styles/styles.css" />
|
<link rel="stylesheet" type="text/css" href="${getStaticDir()}/styles/styles.css" />
|
||||||
|
|
||||||
<!-- Current theme and more -->
|
<!-- Current theme and more -->
|
||||||
${helmet.link.toString() || fallbackTheme}
|
${helmet.link.toString() || fallbackTheme}
|
||||||
|
@ -102,7 +103,7 @@ export async function createSsrHtml(
|
||||||
</noscript>
|
</noscript>
|
||||||
|
|
||||||
<div id='root'>${root}</div>
|
<div id='root'>${root}</div>
|
||||||
<script defer src='/static/js/client.js'></script>
|
<script defer src='${getStaticDir()}/js/client.js'></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { getStaticDir } from "@utils/env";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import { I18NextService } from "../../services";
|
import { I18NextService } from "../../services";
|
||||||
|
@ -23,7 +24,9 @@ export class Icon extends Component<IconProps, any> {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<use
|
<use
|
||||||
xlinkHref={`/static/assets/symbols.svg#icon-${this.props.icon}`}
|
xlinkHref={`${getStaticDir()}/assets/symbols.svg#icon-${
|
||||||
|
this.props.icon
|
||||||
|
}`}
|
||||||
></use>
|
></use>
|
||||||
<div className="visually-hidden">
|
<div className="visually-hidden">
|
||||||
<title>{this.props.icon}</title>
|
<title>{this.props.icon}</title>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { capitalizeFirstLetter, formatPastDate } from "@utils/helpers";
|
import { capitalizeFirstLetter, formatPastDate } from "@utils/helpers";
|
||||||
import { formatInTimeZone } from "date-fns-tz";
|
import { format } from "date-fns";
|
||||||
import parseISO from "date-fns/parseISO";
|
import parseISO from "date-fns/parseISO";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import { I18NextService } from "../../services";
|
import { I18NextService } from "../../services";
|
||||||
|
@ -13,9 +13,8 @@ interface MomentTimeProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(input: string) {
|
function formatDate(input: string) {
|
||||||
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
||||||
const parsed = parseISO(input + "Z");
|
const parsed = parseISO(input + "Z");
|
||||||
return formatInTimeZone(parsed, tz, "PPPPpppp");
|
return format(parsed, "PPPPpppp");
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MomentTime extends Component<MomentTimeProps, any> {
|
export class MomentTime extends Component<MomentTimeProps, any> {
|
||||||
|
|
|
@ -279,13 +279,15 @@ export class Home extends Component<any, HomeState> {
|
||||||
trendingCommunitiesRes,
|
trendingCommunitiesRes,
|
||||||
commentsRes,
|
commentsRes,
|
||||||
postsRes,
|
postsRes,
|
||||||
tagline: getRandomFromList(this.state?.siteRes?.taglines ?? [])
|
|
||||||
?.content,
|
|
||||||
isIsomorphic: true,
|
isIsomorphic: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
HomeCacheService.postsRes = postsRes;
|
HomeCacheService.postsRes = postsRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.state.tagline = getRandomFromList(
|
||||||
|
this.state?.siteRes?.taglines ?? []
|
||||||
|
)?.content;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
|
@ -205,12 +205,10 @@ export class Setup extends Component<any, State> {
|
||||||
const data = i.state.registerRes.data;
|
const data = i.state.registerRes.data;
|
||||||
|
|
||||||
UserService.Instance.login(data);
|
UserService.Instance.login(data);
|
||||||
if (UserService.Instance.jwtInfo) {
|
|
||||||
i.setState({ doneRegisteringUser: true });
|
i.setState({ doneRegisteringUser: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async handleCreateSite(form: CreateSite) {
|
async handleCreateSite(form: CreateSite) {
|
||||||
const createRes = await HttpService.client.createSite(form);
|
const createRes = await HttpService.client.createSite(form);
|
||||||
|
|
|
@ -141,7 +141,7 @@ export class TaglineForm extends Component<TaglineFormProps, TaglineFormState> {
|
||||||
|
|
||||||
handleEditTaglineClick(d: { i: TaglineForm; index: number }, event: any) {
|
handleEditTaglineClick(d: { i: TaglineForm; index: number }, event: any) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (this.state.editingRow == d.index) {
|
if (d.i.state.editingRow == d.index) {
|
||||||
d.i.setState({ editingRow: undefined });
|
d.i.setState({ editingRow: undefined });
|
||||||
} else {
|
} else {
|
||||||
d.i.setState({ editingRow: d.index });
|
d.i.setState({ editingRow: d.index });
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { showAvatars } from "@utils/app";
|
import { showAvatars } from "@utils/app";
|
||||||
|
import { getStaticDir } from "@utils/env";
|
||||||
import { hostname, isCakeDay } from "@utils/helpers";
|
import { hostname, isCakeDay } from "@utils/helpers";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
|
@ -88,7 +89,7 @@ export class PersonListing extends Component<PersonListingProps, any> {
|
||||||
!this.props.person.banned &&
|
!this.props.person.banned &&
|
||||||
showAvatars() && (
|
showAvatars() && (
|
||||||
<PictrsImage
|
<PictrsImage
|
||||||
src={avatar ?? "/static/assets/icons/icon-96x96.png"}
|
src={avatar ?? `${getStaticDir()}/assets/icons/icon-96x96.png`}
|
||||||
icon
|
icon
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -333,7 +333,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="thumbnail rounded overflow-hidden d-inline-block position-relative mb-2 p-0 border-0"
|
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
|
||||||
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
||||||
onClick={linkEvent(this, this.handleImageExpandClick)}
|
onClick={linkEvent(this, this.handleImageExpandClick)}
|
||||||
aria-label={I18NextService.i18n.t("expand_here")}
|
aria-label={I18NextService.i18n.t("expand_here")}
|
||||||
|
@ -348,7 +348,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
} else if (!this.props.hideImage && url && thumbnail && this.imageSrc) {
|
} else if (!this.props.hideImage && url && thumbnail && this.imageSrc) {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
className="thumbnail rounded bg-light d-flex justify-content-center"
|
className="thumbnail rounded overflow-hidden d-inline-block position-relative p-0 border-0"
|
||||||
href={url}
|
href={url}
|
||||||
rel={relTags}
|
rel={relTags}
|
||||||
title={url}
|
title={url}
|
||||||
|
@ -403,8 +403,9 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
|
|
||||||
createdLine() {
|
createdLine() {
|
||||||
const post_view = this.postView;
|
const post_view = this.postView;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="small">
|
<div className="small mb-1 mb-md-0">
|
||||||
<span className="me-1">
|
<span className="me-1">
|
||||||
<PersonListing person={post_view.creator} />
|
<PersonListing person={post_view.creator} />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
export const favIconUrl = "/static/assets/icons/favicon.svg";
|
import { getStaticDir } from "@utils/env";
|
||||||
export const favIconPngUrl = "/static/assets/icons/apple-touch-icon.png";
|
|
||||||
|
export const favIconUrl = `${getStaticDir()}/assets/icons/favicon.svg`;
|
||||||
|
export const favIconPngUrl = `${getStaticDir()}/assets/icons/apple-touch-icon.png`;
|
||||||
|
|
||||||
export const repoUrl = "https://github.com/LemmyNet";
|
export const repoUrl = "https://github.com/LemmyNet";
|
||||||
export const joinLemmyUrl = "https://join-lemmy.org";
|
export const joinLemmyUrl = "https://join-lemmy.org";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export default function isAuthPath(pathname: string) {
|
export default function isAuthPath(pathname: string) {
|
||||||
return /create_.*|inbox|settings|admin|reports|registration_applications/g.test(
|
return /^\/create_.*|inbox|settings|admin|reports|registration_applications/g.test(
|
||||||
pathname
|
pathname
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
5
src/shared/utils/env/get-static-dir.ts
vendored
Normal file
5
src/shared/utils/env/get-static-dir.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// Returns path to static directory, intended
|
||||||
|
// for cache-busting based on latest commit hash.
|
||||||
|
export default function getStaticDir() {
|
||||||
|
return `/static/${process.env.COMMIT_HASH}`;
|
||||||
|
}
|
2
src/shared/utils/env/index.ts
vendored
2
src/shared/utils/env/index.ts
vendored
|
@ -6,6 +6,7 @@ import getHttpBaseExternal from "./get-http-base-external";
|
||||||
import getHttpBaseInternal from "./get-http-base-internal";
|
import getHttpBaseInternal from "./get-http-base-internal";
|
||||||
import getInternalHost from "./get-internal-host";
|
import getInternalHost from "./get-internal-host";
|
||||||
import getSecure from "./get-secure";
|
import getSecure from "./get-secure";
|
||||||
|
import getStaticDir from "./get-static-dir";
|
||||||
import httpExternalPath from "./http-external-path";
|
import httpExternalPath from "./http-external-path";
|
||||||
import isHttps from "./is-https";
|
import isHttps from "./is-https";
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ export {
|
||||||
getHttpBaseInternal,
|
getHttpBaseInternal,
|
||||||
getInternalHost,
|
getInternalHost,
|
||||||
getSecure,
|
getSecure,
|
||||||
|
getStaticDir,
|
||||||
httpExternalPath,
|
httpExternalPath,
|
||||||
isHttps,
|
isHttps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,8 @@ const banner = `
|
||||||
@license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
|
@license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const base = {
|
function getBase(env, mode) {
|
||||||
|
return {
|
||||||
output: {
|
output: {
|
||||||
filename: "js/server.js",
|
filename: "js/server.js",
|
||||||
publicPath: "/",
|
publicPath: "/",
|
||||||
|
@ -51,6 +52,10 @@ const base = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
"process.env.COMMIT_HASH": `"${env.COMMIT_HASH}"`,
|
||||||
|
"process.env.NODE_ENV": `"${mode}"`,
|
||||||
|
}),
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "styles/styles.css",
|
filename: "styles/styles.css",
|
||||||
}),
|
}),
|
||||||
|
@ -61,9 +66,11 @@ const base = {
|
||||||
banner,
|
banner,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const createServerConfig = (_env, mode) => {
|
const createServerConfig = (env, mode) => {
|
||||||
|
const base = getBase(env, mode);
|
||||||
const config = merge({}, base, {
|
const config = merge({}, base, {
|
||||||
mode,
|
mode,
|
||||||
entry: "./src/server/index.tsx",
|
entry: "./src/server/index.tsx",
|
||||||
|
@ -90,13 +97,14 @@ const createServerConfig = (_env, mode) => {
|
||||||
return config;
|
return config;
|
||||||
};
|
};
|
||||||
|
|
||||||
const createClientConfig = (_env, mode) => {
|
const createClientConfig = (env, mode) => {
|
||||||
|
const base = getBase(env, mode);
|
||||||
const config = merge({}, base, {
|
const config = merge({}, base, {
|
||||||
mode,
|
mode,
|
||||||
entry: "./src/client/index.tsx",
|
entry: "./src/client/index.tsx",
|
||||||
output: {
|
output: {
|
||||||
filename: "js/client.js",
|
filename: "js/client.js",
|
||||||
publicPath: "/static/",
|
publicPath: `/static/${env.COMMIT_HASH}/`,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...base.plugins,
|
...base.plugins,
|
||||||
|
@ -104,7 +112,7 @@ const createClientConfig = (_env, mode) => {
|
||||||
enableInDevelopment: mode !== "development", // this may seem counterintuitive, but it is correct
|
enableInDevelopment: mode !== "development", // this may seem counterintuitive, but it is correct
|
||||||
workbox: {
|
workbox: {
|
||||||
modifyURLPrefix: {
|
modifyURLPrefix: {
|
||||||
"/": "/static/",
|
"/": `/static/${env.COMMIT_HASH}/`,
|
||||||
},
|
},
|
||||||
cacheId: "lemmy",
|
cacheId: "lemmy",
|
||||||
include: [/(assets|styles|js)\/.+\..+$/g],
|
include: [/(assets|styles|js)\/.+\..+$/g],
|
||||||
|
|
|
@ -3237,11 +3237,6 @@ dashdash@^1.12.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
assert-plus "^1.0.0"
|
assert-plus "^1.0.0"
|
||||||
|
|
||||||
date-fns-tz@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-2.0.0.tgz#1b14c386cb8bc16fc56fe333d4fc34ae1d1099d5"
|
|
||||||
integrity sha512-OAtcLdB9vxSXTWHdT8b398ARImVwQMyjfYGkKD2zaGpHseG2UPHbHjXELReErZFxWdSLph3c2zOaaTyHfOhERQ==
|
|
||||||
|
|
||||||
date-fns@^2.30.0:
|
date-fns@^2.30.0:
|
||||||
version "2.30.0"
|
version "2.30.0"
|
||||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
|
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue