Skip to content

Commit c9f8f85

Browse files
Convert standalone entry to CJS
When using node's single executable application (SEA) feature a known limitation is that only commonjs (CJS) is supported, extract from Node.js docs[1]: > The single executable application feature currently only supports > running a single embedded script using the CommonJS module system. [1] https://nodejs.org/docs/latest-v25.x/api/single-executable-applications.html#single-executable-applications
1 parent d1040cc commit c9f8f85

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

desktop/packages/mullvad-vpn/standalone-tests.ts renamed to desktop/packages/mullvad-vpn/standalone-tests.cts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { getRawAsset } from 'node:sea';
22

3-
import child_process, { spawn } from 'child_process';
4-
import fs from 'fs';
5-
import os from 'os';
6-
import path from 'path';
3+
import * as child_process from 'child_process';
4+
import * as fs from 'fs';
5+
import * as os from 'os';
6+
import * as path from 'path';
7+
8+
const { spawn } = child_process;
79

810
// This file is bundled into a standalone executable able to run e2e tests against an installed
911
// version of the app. This file is the entrypoint in the executable and extracts the required
@@ -103,8 +105,8 @@ function runTests(): Promise<number> {
103105
const args = [playwrightBin, 'test', '-x', '-c', configPath, ...process.argv.slice(2)];
104106
const proc = spawn(nodeBin, args, { cwd: tmpDir });
105107

106-
proc.stdout.on('data', (data) => console.log(data.toString()));
107-
proc.stderr.on('data', (data) => console.error(data.toString()));
108+
proc.stdout.on('data', (data: unknown) => console.log((data as string).toString()));
109+
proc.stderr.on('data', (data: unknown) => console.error((data as string).toString()));
108110
proc.on('close', (code, signal) => {
109111
if (signal) {
110112
console.log('Received signal:', signal);

desktop/packages/mullvad-vpn/standalone-tests.sea.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"main": "./build-standalone/standalone-tests.js",
2+
"main": "./build-standalone/standalone-tests.cjs",
33
"output": "./standalone-tests.sea.blob",
44
"disableExperimentalSEAWarning": true,
55
"useSnapshot": false,

desktop/packages/mullvad-vpn/tsconfig.standalone.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"src/**/*.tsx",
1111
"test/e2e/**/*.ts",
1212
"playwright.config.ts",
13-
"standalone-tests.ts"
13+
"standalone-tests.cts"
1414
]
1515
}

0 commit comments

Comments
 (0)