Skip to content

Etherpad 2.x won't build cleanly on FreeBSD x64 #6696

Description

@raybellis

Describe the bug
The build system has development dependencies on NodeJS modules for which no FreeBSD-x64 native builds exists

To Reproduce
Steps to reproduce the behavior:

Follow the standard build instructions from README.md to the letter.

Expected behavior

A clean build? ;)

Screenshots

Rollup issue
Rollup has no native build on FreeBSD - a WASM build is required instead

% pnpm run build:etherpad
...
> tsc && vite build --outDir ../src/templates/admin --emptyOutDir

/var/home/etherpad/etherpad-lite-2.2.5/node_modules/.pnpm/rollup@4.24.0/node_modules/rollup/dist/native.js:84
	throw new Error(
	      ^
Error: Your current platform "freebsd" and architecture "x64" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.
...

Vite React SWC plugin issue
vitejs/plugin-react-swc also has some native dependency, and tries to load a non-existent @swc/core-wasm32-wasi module if that's not found.

% pnpm run build:etherpad
...
> tsc && vite build --outDir ../src/templates/admin --emptyOutDir

failed to load config from /var/home/etherpad/etherpad-lite-2.2.5/admin/vite.config.ts
error during build:
...

Server (please complete the following information):

  • Etherpad version: 2.2.5
  • OS: FreeBSD 14.1
  • Node.js version (node --version): v20.15.1
  • npm version (npm --version): 10.8.1
  • pnpm version (pnpm --version): 9.12.0
  • Is the server free of plugins: Yes

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Fixes

I don't necessarily propose that these should be adopted universally, but they're what worked for me. That said, they should work universally at the expense of a little build time. They tell Rollup to use the WASM compiler, and use the standard Vite React plugin instead of the SWC version:

diff --git a/package.json b/package.json
index d4e94f017..9432ec822 100644
--- a/package.json
+++ b/package.json
@@ -50,6 +50,11 @@
     "type": "git",
     "url": "https://github.com/ether/etherpad-lite.git"
   },
+  "pnpm": {
+    "overrides": {
+      "rollup": "npm:@rollup/wasm-node"
+    }
+  },
   "version": "2.2.5",
   "license": "Apache-2.0"
 }
diff --git a/admin/package.json b/admin/package.json
index f0d52d2ac..9f2f849f0 100644
--- a/admin/package.json
+++ b/admin/package.json
@@ -20,7 +20,7 @@
     "@types/react-dom": "^18.2.25",
     "@typescript-eslint/eslint-plugin": "^8.6.0",
     "@typescript-eslint/parser": "^8.6.0",
-    "@vitejs/plugin-react-swc": "^3.5.0",
+    "@vitejs/plugin-react": "^4.3.2",
     "eslint": "^9.10.0",
     "eslint-plugin-react-hooks": "^4.6.0",
     "eslint-plugin-react-refresh": "^0.4.12",
diff --git a/admin/vite.config.ts b/admin/vite.config.ts
index 23921ca85..4ee4f01be 100644
--- a/admin/vite.config.ts
+++ b/admin/vite.config.ts
@@ -1,5 +1,5 @@
 import { defineConfig } from 'vite'
-import react from '@vitejs/plugin-react-swc'
+import react from '@vitejs/plugin-react'
 import svgr from 'vite-plugin-svgr'
 import {viteStaticCopy} from "vite-plugin-static-copy";
 

After applying this patch it's necessary to remove pnpm-lock.json before running pnpm i.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions