Skip to content

Commit

Permalink
perf(ws): make polyfill exclusion flag static
Browse files Browse the repository at this point in the history
- Use static (build-time) defines to disable optional deps of ws.
  • Loading branch information
skjsjhb committed Jan 10, 2025
1 parent 67bc6d1 commit 5db9de4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions build-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export async function build(variant: BuildVariant) {
const defines = {
"__dirname": "import.meta.dirname",
"__filename": "import.meta.filename",

// Exclude polyfills from the ws library
"process.env.WS_NO_BUFFER_UTIL": JSON.stringify("true"),
"process.env.WS_NO_UTF_8_VALIDATE": JSON.stringify("true"),
...defs
};

Expand Down
4 changes: 1 addition & 3 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ let mainWindow: BrowserWindow | null = null;
*/
async function main() {
process.noAsar = true;
process.env.WS_NO_BUFFER_UTIL = "true";
process.env.WS_NO_UTF_8_VALIDATE = "true";

if (!checkSingleInstance()) return;

Expand All @@ -49,7 +47,7 @@ async function main() {

console.log("Initializing modules...");
conf.setup();

if (import.meta.env.AL_TEST) {
paths.setup({
storeRoot: path.resolve("emulated", "store")
Expand Down

0 comments on commit 5db9de4

Please sign in to comment.