Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: add building from source cmd (#1287)

Myles Scolnick9da9a9b76f80
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8b10388937..8368b562dd 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -47,6 +47,14 @@ make fe && make py
(All `make` commands should be run in the project's root directory.)
+**Building from source, unminified.**
+
+To build the frontend unminified, run:
+
+```bash
+NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=development make fe -B
+```
+
## Lint, Typecheck, Format
**All checks.**
diff --git a/frontend/vite.config.mts b/frontend/vite.config.mts
index a9a9a2355a..1e49ef82b0 100644
--- a/frontend/vite.config.mts
+++ b/frontend/vite.config.mts
@@ -105,6 +105,10 @@ export default defineConfig({
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
+ build: {
+ minify: isDev ? false : "terser",
+ sourcemap: isDev,
+ },
resolve: {
dedupe: ["react", "react-dom", "@emotion/react", "@emotion/cache"],
},
diff --git a/scripts/buildfrontend.sh b/scripts/buildfrontend.sh
index d2b7aea90a..489169cab7 100755
--- a/scripts/buildfrontend.sh
+++ b/scripts/buildfrontend.sh
@@ -1,7 +1,15 @@
#!/bin/sh
+# If NODE_ENV is development, then we build the frontend in development mode.
+# Otherwise, we build the frontend in production mode.
+if [ "$NODE_ENV" = "development" ]; then
+ cmd="pnpm turbo build -- --mode development"
+else
+ cmd="pnpm turbo build"
+fi
+
cd frontend
-if pnpm turbo build; then
+if $cmd; then
echo "Removing old static files..."
rm -rf ../marimo/_static/
echo "Copying new static files..."