#4235·tamagui

[V2] `@tamagui/slider` starts a `setInterval` on import that keeps Node alive and `expo export --platform web` never exits

Author: dieguezguilleCreated Sep 28, 2026Updated Sep 28, 2026

Current Behavior

Importing tamagui from the web build starts a module-level 1s setInterval in @tamagui/slider, even if no Slider is ever rendered. Nothing guards it in Node, so any process that loads the web entry never exits:

bash
node -e "require('tamagui')"                                    # never exits
TAMAGUI_DISABLE_SLIDER_INTERVAL=1 node -e "require('tamagui')"  # exits

With Expo Router static rendering, expo export --platform web prints Exported: dist and then hangs forever. In CI it is a job that never finishes and prints no error.

Cause: 1.x guarded the interval with isWeb && isClient. f030659 replaced that with process.env.TAMAGUI_TARGET === 'web', which is inlined when the dist is built, so every 2.x web dist (dist/{esm,jsx}/Slider.mjs, dist/cjs/Slider.cjs) ships it unconditionally. The v3 beta already made the interval lazy in #4129; that was never ported to v2. Same class of bug as #540 / #543.

Expected Behavior

Importing tamagui should not keep Node alive.

Minimal fix, which we ship as a pnpm patch. Browsers are unaffected because setInterval returns a number there:

diff
 if (!process.env.TAMAGUI_DISABLE_SLIDER_INTERVAL) setInterval?.(() => {
   activeSliderMeasureListeners.forEach(cb => cb());
-}, 1e3);
+}, 1e3)?.unref?.();

Ideal fix: backport the lazy interval from #4129 to v2.

Workaround: TAMAGUI_DISABLE_SLIDER_INTERVAL=1 expo export --platform web.

Tamagui Version

markdown
2.7.7 (latest), unchanged on main @ 0eb99e3. Every 2.x since 2.0.0.
Not affected: 1.144.4 and the 3.0.0 betas.

Platform (Web, iOS, Android)

markdown
Web, when the web build runs in Node (static export / SSR). Native is not affected.

Reproduction

markdown
https://github.com/dieguezguille/tamagui-slider-interval-repro

Expo Router, web.output "static", one route that only imports `isWeb` from tamagui. No Slider anywhere.

pnpm install
pnpm repro          # main: require/import('tamagui') still alive after 5s
pnpm repro:export   # main: expo export hangs after "Exported: dist"

git checkout with-fix && pnpm install
pnpm repro          # exits in ~0.3s
pnpm repro:export   # exits in ~5s

System Info

markdown
macOS 27.0 (arm64), Node 24.13.0, pnpm 11.5.2
expo 55.0.31, expo-router 55.0.18, react-native 0.83.10, react-native-web 0.21.2, react 19.2.0
tamagui / @tamagui/slider 2.7.7