mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-08 09:34:16 +00:00
Fix things not working in production build
This commit is contained in:
parent
23d7751523
commit
dbee2533a2
|
@ -7,7 +7,6 @@ WORKDIR /usr/src/app
|
|||
ENV npm_config_target_arch=x64
|
||||
ENV npm_config_target_platform=linux
|
||||
ENV npm_config_target_libc=musl
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# Cache deps
|
||||
COPY package.json yarn.lock ./
|
||||
|
|
|
@ -6,7 +6,6 @@ WORKDIR /usr/src/app
|
|||
ENV npm_config_target_arch=x64
|
||||
ENV npm_config_target_platform=linux
|
||||
ENV npm_config_target_libc=musl
|
||||
ENV NODE_ENV=development
|
||||
|
||||
# Cache deps
|
||||
COPY package.json yarn.lock ./
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
"isomorphic-cookie": "^1.2.4",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"lemmy-js-client": "0.17.2-rc.15",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-container": "^3.0.0",
|
||||
"markdown-it-emoji": "^2.0.2",
|
||||
|
@ -77,6 +78,7 @@
|
|||
"sass": "^1.62.1",
|
||||
"sass-loader": "^13.2.2",
|
||||
"serialize-javascript": "^6.0.1",
|
||||
"service-worker-webpack": "^1.0.0",
|
||||
"sharp": "^0.32.1",
|
||||
"tippy.js": "^6.3.7",
|
||||
"toastify-js": "^1.12.0",
|
||||
|
@ -111,7 +113,6 @@
|
|||
"prettier-plugin-organize-imports": "^3.2.2",
|
||||
"prettier-plugin-packagejson": "^2.4.3",
|
||||
"rimraf": "^5.0.0",
|
||||
"service-worker-webpack": "^1.0.0",
|
||||
"sortpack": "^2.3.4",
|
||||
"style-loader": "^3.3.2",
|
||||
"terser": "^5.17.3",
|
||||
|
|
|
@ -27,8 +27,6 @@ import {
|
|||
isAuthPath,
|
||||
} from "../shared/utils";
|
||||
|
||||
const { NODE_ENV } = process.env as Record<string, string>;
|
||||
|
||||
const server = express();
|
||||
const [hostname, port] = process.env["LEMMY_UI_HOST"]
|
||||
? process.env["LEMMY_UI_HOST"].split(":")
|
||||
|
@ -184,7 +182,7 @@ server.get("/*", async (req, res) => {
|
|||
const isoData: IsoDataOptionalSite = {
|
||||
path,
|
||||
site_res: site,
|
||||
routeData,
|
||||
routeData: getErrorRouteData("lel", site),
|
||||
};
|
||||
|
||||
const wrapper = (
|
||||
|
@ -200,7 +198,9 @@ server.get("/*", async (req, res) => {
|
|||
// If an error is caught here, the error page couldn't even be rendered
|
||||
console.error(err);
|
||||
res.statusCode = 500;
|
||||
return res.send(NODE_ENV === "development" ? err.message : "Server error");
|
||||
return res.send(
|
||||
process.env.NODE_ENV === "development" ? err.message : "Server error"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -295,9 +295,11 @@ async function fetchIconPng(iconUrl: string) {
|
|||
function getErrorRouteData(error: string, site?: GetSiteResponse) {
|
||||
const errorPageData: ErrorPageData = { type: "error" };
|
||||
|
||||
console.log(`Error: ${process.env.NODE_ENV}`);
|
||||
|
||||
// Exact error should only be seen in a development environment. Users
|
||||
// in production will get a more generic message.
|
||||
if (NODE_ENV === "development") {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
errorPageData.error = error;
|
||||
}
|
||||
|
||||
|
|
|
@ -5546,7 +5546,7 @@ lodash@^3.10.1:
|
|||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
|
||||
integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ==
|
||||
|
||||
lodash@^4.17.20:
|
||||
lodash@^4.17.20, lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
|
Loading…
Reference in a new issue