Skip to content

Commit

Permalink
Revert "Fix CUSTOM_LEMMY_SERVERS when installed (aeharding#127)" (aeh…
Browse files Browse the repository at this point in the history
…arding#133)

This reverts commit 8bde519.
  • Loading branch information
aeharding authored Jul 1, 2023
1 parent 77dac88 commit e92dc45
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 51 deletions.
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@
{
"files": ["src/**"],
"globals": {
"APP_VERSION": true,
"CUSTOM_LEMMY_SERVERS": true
"APP_VERSION": true
}
}
]
Expand Down
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions src/helpers/lemmy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Comment, CommentView, Community } from "lemmy-js-client";

export const LEMMY_SERVERS =
typeof CUSTOM_LEMMY_SERVERS !== "undefined"
? (CUSTOM_LEMMY_SERVERS as string).split(",")
"CUSTOM_LEMMY_SERVERS" in window
? (window.CUSTOM_LEMMY_SERVERS as string[])
: ["lemmy.world", "lemmy.ml", "beehaw.org", "sh.itjust.works"];

export interface LemmyJWT {
Expand Down
1 change: 0 additions & 1 deletion src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
/// <reference types="vite-plugin-pwa/react" />

declare const APP_VERSION: string;
declare const CUSTOM_LEMMY_SERVERS: string;
76 changes: 35 additions & 41 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,42 @@ import { defineConfig } from "vitest/config";
import { VitePWA } from "vite-plugin-pwa";
import svgr from "vite-plugin-svgr";
import legacy from "@vitejs/plugin-legacy";
import { loadEnv } from "vite";

// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd(), "") };

return defineConfig({
plugins: [
react({
jsxImportSource: "@emotion/react",
babel: {
plugins: ["@emotion/babel-plugin"],
},
}),
svgr(),
VitePWA({ registerType: "prompt" }),
legacy({
modernPolyfills: ["es.array.at"],
}),
],
// TODO: Outdated clients trying to access stale codesplit js chucks
// break. This breaks iOS transitions.
// Put everything into one chunk for now.
build: {
rollupOptions: {
output: {
manualChunks: () => "index.js",
},
export default defineConfig({
plugins: [
react({
jsxImportSource: "@emotion/react",
babel: {
plugins: ["@emotion/babel-plugin"],
},
}),
svgr(),
VitePWA({ registerType: "prompt" }),
legacy({
modernPolyfills: ["es.array.at"],
}),
],
// TODO: Outdated clients trying to access stale codesplit js chucks
// break. This breaks iOS transitions.
// Put everything into one chunk for now.
build: {
rollupOptions: {
output: {
manualChunks: () => "index.js",
},
},
define: {
// eslint-disable-next-line no-undef
APP_VERSION: JSON.stringify(process.env.npm_package_version),
CUSTOM_LEMMY_SERVERS: JSON.stringify(process.env.CUSTOM_LEMMY_SERVERS),
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/setupTests.ts",
},
optimizeDeps: {
exclude: ["mdast-util-gfm-autolink-literal-lemmy"],
},
});
};
},
define: {
// eslint-disable-next-line no-undef
APP_VERSION: JSON.stringify(process.env.npm_package_version),
},
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/setupTests.ts",
},
optimizeDeps: {
exclude: ["mdast-util-gfm-autolink-literal-lemmy"],
},
});

0 comments on commit e92dc45

Please sign in to comment.