diff --git a/src/Components/App.tsx b/src/Components/App.tsx
index dda87df8..1609e4ef 100644
--- a/src/Components/App.tsx
+++ b/src/Components/App.tsx
@@ -364,6 +364,7 @@ export function App({
>
@@ -410,6 +411,7 @@ export function App({
>
@@ -496,7 +498,11 @@ export function App({
appEngine={appEngine}
/>
-
+
);
} else if (appMode === "viewer") {
@@ -519,6 +525,7 @@ export function App({
>
diff --git a/src/Components/Viewer.tsx b/src/Components/Viewer.tsx
index 43fa2cbb..6eb7b629 100644
--- a/src/Components/Viewer.tsx
+++ b/src/Components/Viewer.tsx
@@ -126,9 +126,11 @@ async function resetRAppFrame(
export function Viewer({
proxyHandle,
setViewerMethods,
+ devMode = false,
}: {
proxyHandle: ProxyHandle;
setViewerMethods: React.Dispatch>;
+ devMode?: boolean;
}) {
const viewerFrameRef = React.useRef(null);
const [appRunningState, setAppRunningState] = React.useState<
@@ -268,6 +270,7 @@ export function Viewer({
await pyodideproxy.callPyAsync({
fnName: ["_start_app"],
args: [appName],
+ kwargs: { dev_mode: devMode },
});
viewerFrameRef.current.src = appInfo.urlPath;
diff --git a/src/hooks/usePyodide.tsx b/src/hooks/usePyodide.tsx
index b80137e6..ed9875af 100644
--- a/src/hooks/usePyodide.tsx
+++ b/src/hooks/usePyodide.tsx
@@ -518,7 +518,8 @@ class ShinyExpressAppModule:
import shiny.express
self.app = shiny.express.wrap_express_app(app_path)
-async def _start_app(app_name, scope = _shiny_app_registry):
+async def _start_app(app_name, scope = _shiny_app_registry, dev_mode = False):
+ import os
import sys
import importlib
import shiny.express
@@ -537,11 +538,18 @@ async def _start_app(app_name, scope = _shiny_app_registry):
class ModuleApp:
app = None
+ if dev_mode:
+ # Enable shiny dev mode for error console
+ os.environ["SHINY_DEV_MODE"] = "1"
+
if shiny.express.is_express_app("app.py", app_dir):
app_obj = ShinyExpressAppModule(Path(app_dir) / "app.py")
else:
app_obj = importlib.import_module(f"{app_name}.app")
+ if dev_mode:
+ os.environ.pop("SHINY_DEV_MODE")
+
scope[app_name] = app_obj
sys.path.remove(app_dir)