Skip to content

Commit 89b3660

Browse files
author
AJ Griffiths
committed
fix Tailwind 4 production build OOM by scoping source detection
Tailwind 4's automatic source detection scans from the current working directory. The Docker frontend stage has no WORKDIR, so cwd is `/` and Tailwind tries to ingest the entire container filesystem. That work happens in oxide/lightningcss native (off-heap) code, so the build ran ~11 minutes and was then OOM-killed -- and raising --max-old-space-size never helped, because that only bounds the V8 heap, not native memory. Disable auto-detection with `source(none)` and declare the sources explicitly instead (mirroring the previous tailwind.config.js `content` globs, including .py for classes used in Wagtail blocks/widgets). The theme is loaded explicitly via @config. Frontend docker build (npm run build:prod): 651s + OOM -> ~3s.
1 parent 7512040 commit 89b3660

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tbx/static_src/sass/main.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@
9393

9494
// Layout
9595

96-
@import 'tailwindcss';
96+
// `source(none)` disables Tailwind 4's automatic source detection, which
97+
// otherwise scans from the current working directory — that is `/` inside the
98+
// Docker build stage (no WORKDIR), so it tries to ingest the whole container
99+
// filesystem and OOM-hangs the build. We instead load the JS config and list
100+
// the source globs explicitly (paths are relative to this file).
101+
@import 'tailwindcss' source(none);
102+
@config '../../../tailwind.config.js';
103+
@source '../../**/*.{py,html}';
104+
@source '../**/*.{js,ts,tsx,vue}';
97105

98106
@utility container {
99107
margin-inline: auto;

0 commit comments

Comments
 (0)