TanStack AI version
0.1.3
Framework/Library version
@tanstack/ai-code-mode-skills
Describe the bug and the steps to reproduce it
@tanstack/ai-code-mode-skills v0.1.3 appears to be unsafe to import from Cloudflare Worker / browser-oriented builds, even when only using non-file-storage APIs such as createSkillManagementTools or createSkillsSystemPrompt.
The package root export (@tanstack/ai-code-mode-skills) eagerly imports createFileSkillStorage, which pulls in node:fs and node:path. In worker/browser bundlers this causes the build to fail before runtime.
Reproduction
In a Nuxt app targeting Cloudflare Pages / Workers, import a non-storage API from the package root:
import {
createSkillManagementTools,
createSkillsSystemPrompt,
} from "@tanstack/ai-code-mode-skills"
Then build for Cloudflare Pages:
nuxt build --preset=cloudflare_pages
Actual result
Build fails with:
RollupError: .../@tanstack/ai-code-mode-skills/dist/esm/storage/file-storage.js (2:9):
"join" is not exported by "__vite-browser-external", imported by
".../storage/file-storage.js"
1: import { rm, mkdir, writeFile, readFile } from "node:fs/promises";
2: import { join } from "node:path";
^
3: import { existsSync } from "node:fs";
Expected result
Importing non-Node APIs like createSkillManagementTools and createSkillsSystemPrompt from the package root should not force bundlers to include Node-only storage code.
At minimum, there should be a public worker/browser-safe subpath that exposes the non-storage helpers without pulling in node:fs / node:path.
Likely cause
The root entry eagerly imports createFileSkillStorage:
// dist/esm/index.js
import { createFileSkillStorage } from "./storage/file-storage.js";
And file-storage.js imports Node-only modules:
import { rm, mkdir, writeFile, readFile } from "node:fs/promises";
import { join } from "node:path";
import { existsSync } from "node:fs";
So even consumers that do not use file storage still get a root entry that is not safe for Worker/browser bundlers.
Suggested fixes
Any of these would help:
- Remove Node-only storage exports from the root entry.
- Expose worker-safe/public subpaths for non-storage APIs.
- Use conditional exports (
node vs browser / worker-safe entrypoints).
- Keep file storage behind
@tanstack/ai-code-mode-skills/storage only, without re-exporting it from ..
Environment
@tanstack/ai-code-mode-skills: 0.1.3
@tanstack/ai-code-mode: 0.1.3
@tanstack/ai: 0.10.3
- Nuxt:
4.4.2
- Vite:
7.3.1
- Target: Cloudflare Pages / Workers
- Build preset:
cloudflare_pages
Notes
This seems especially relevant for frameworks that build server code through Worker-compatible bundlers, where Node built-ins are externalized or shimmed for browser-like environments.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
see description
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
TanStack AI version
0.1.3
Framework/Library version
@tanstack/ai-code-mode-skills
Describe the bug and the steps to reproduce it
@tanstack/ai-code-mode-skillsv0.1.3 appears to be unsafe to import from Cloudflare Worker / browser-oriented builds, even when only using non-file-storage APIs such ascreateSkillManagementToolsorcreateSkillsSystemPrompt.The package root export (
@tanstack/ai-code-mode-skills) eagerly importscreateFileSkillStorage, which pulls innode:fsandnode:path. In worker/browser bundlers this causes the build to fail before runtime.Reproduction
In a Nuxt app targeting Cloudflare Pages / Workers, import a non-storage API from the package root:
Then build for Cloudflare Pages:
Actual result
Build fails with:
RollupError: .../@tanstack/ai-code-mode-skills/dist/esm/storage/file-storage.js (2:9): "join" is not exported by "__vite-browser-external", imported by ".../storage/file-storage.js" 1: import { rm, mkdir, writeFile, readFile } from "node:fs/promises"; 2: import { join } from "node:path"; ^ 3: import { existsSync } from "node:fs";Expected result
Importing non-Node APIs like
createSkillManagementToolsandcreateSkillsSystemPromptfrom the package root should not force bundlers to include Node-only storage code.At minimum, there should be a public worker/browser-safe subpath that exposes the non-storage helpers without pulling in
node:fs/node:path.Likely cause
The root entry eagerly imports
createFileSkillStorage:And
file-storage.jsimports Node-only modules:So even consumers that do not use file storage still get a root entry that is not safe for Worker/browser bundlers.
Suggested fixes
Any of these would help:
nodevsbrowser/ worker-safe entrypoints).@tanstack/ai-code-mode-skills/storageonly, without re-exporting it from..Environment
@tanstack/ai-code-mode-skills:0.1.3@tanstack/ai-code-mode:0.1.3@tanstack/ai:0.10.34.4.27.3.1cloudflare_pagesNotes
This seems especially relevant for frameworks that build server code through Worker-compatible bundlers, where Node built-ins are externalized or shimmed for browser-like environments.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
see description
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct