Summary
In a project that uses pantry (no node_modules, no bun.lock) as the package manager, stx's crosswind loader can't find @cwcss/crosswind even when it lives at pantry/@cwcss/crosswind/. Page renders show [Crosswind] CSS engine not available, Tailwind styles will not be generated and ship unstyled.
Repro
- Pantry-managed project.
./buddy devis invoked; the buddy shell wrapper exportsNODE_PATH=$PWD/pantry. pantry/@stacksjs/stxis a symlink to a local stx source checkout (or it's the vendored copy — same behavior).pantry/@cwcss/crosswind/dist/index.jsexists and exportsCSSGenerator.- Boot the dev server. Output:
[stx] Plugin loaded: stacksjs-components [Crosswind] CSS engine not available, Tailwind styles will not be generated Run 'bun add @stacksjs/crosswind' to enable CSS generation
Root cause
packages/stx/src/dev-server/crosswind.ts → findCrosswindPaths() only walks node_modules/ directories from process.cwd() upward, plus a fixed list of ~/Code/Tools/... and ~/repos/stacks-org/... dev paths. Pantry is not in any of those lists, so a pantry-only project finds zero candidate paths.
The loadCrosswind bare-specifier fallback (Strategy 1, await import('@cwcss/crosswind')) doesn't save us either, because Bun's dynamic-import resolver fails to walk node_modules upward across a package boundary. From inside stx/packages/stx/dist/dev-server/crosswind.js:
Cannot find module '@cwcss/crosswind' from '.../stx/packages/stx/dist/dev-server/_test.js'…even though @cwcss/crosswind lives at stx/node_modules/@cwcss/crosswind AND is declared in stx/packages/stx/package.json. (Worth a separate Bun reproducer — but for stx this means we cannot rely on the bare-specifier path.)
Suggested fix
Add pantry to the cwd walk in findCrosswindPaths:
let currentDir = process.cwd()
while (currentDir !== path.dirname(currentDir)) {
// Try @cwcss/crosswind first (new package name)
paths.push(path.join(currentDir, 'node_modules', '@cwcss', 'crosswind', 'dist', 'index.js'))
paths.push(path.join(currentDir, 'node_modules', '@cwcss', 'crosswind', 'src', 'index.ts'))
+ paths.push(path.join(currentDir, 'pantry', '@cwcss', 'crosswind', 'dist', 'index.js'))
+ paths.push(path.join(currentDir, 'pantry', '@cwcss', 'crosswind', 'src', 'index.ts'))
// Also try @stacksjs/crosswind (legacy package name)
paths.push(path.join(currentDir, 'node_modules', '@stacksjs', 'crosswind', 'dist', 'index.js'))
+ paths.push(path.join(currentDir, 'pantry', '@stacksjs', 'crosswind', 'dist', 'index.js'))
currentDir = path.dirname(currentDir)
}Verified locally: with this patch, loadCrosswind() from inside the running dev server returns:
[Crosswind] CSS engine loaded from .../bench-review/pantry/@cwcss/crosswindBroader pattern
This is one instance of a wider blind spot — multiple stx subsystems assume node_modules/ as the only package store:
findCrosswindPaths(this issue).client-script-bundler.tshad to be patched to add a~/alias for projects that don't have atsconfigpath mapping; same shape of problem.bun-plugin-stx's nested@stacksjs/stxinside its ownnode_modules/shadows linked or pantry copies unless you symlink it manually.storage/framework/core/actions/src/dev/views.tsalready special-casespantry/bun-plugin-stx/dist/serve.js— so the framework is aware of pantry in places, but not consistently.
Worth a follow-up pass: a small helper like resolvePackagePath(name, { searchPantry: true }) used everywhere the framework looks for sibling packages, instead of each subsystem rolling its own walk.
Environment
- stx: 0.2.54 (from
Projects/stxworkspace) - Bun: 1.3.13
- macOS arm64
- Project layout:
pantry/(nonode_modules/, nobun.lock),pantry/@stacksjs/stx → ../../../Projects/stx/packages/stx(symlink to live source).