microsoft / microsoft/TypeChat

[Feature] Support edge runtime like cloudflare worker.

Open
#102 3 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
8.7k
Forks
414
Avg merge
3h 8m
Merged PRs (30d)
3

Description

Descripte

When i want to use typechat do some greate thing on cloudflare worker. when i build, i meet some error.


- warn No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

- info Creating an optimized production build...
Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.
Read more: https://nextjs.org/docs/messages/sharp-missing-in-production
Failed to compile.

../node_modules/.pnpm/typechat@0.0.10/node_modules/typechat/dist/interactive.js:7:29
Module not found: Can't resolve 'fs'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
../node_modules/.pnpm/typechat@0.0.10/node_modules/typechat/dist/index.js
./app/api/typeChat/route.ts
../node_modules/.pnpm/next@13.4.6_@babel+core@7.22.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2FtypeChat%2Froute.ts&page=%2Fapi%2FtypeChat%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdHlwZUNoYXQlMkZyb3V0ZSZwYWdlPSUyRmFwaSUyRnR5cGVDaGF0JTJGcm91dGUmcGFnZVBhdGg9cHJpdmF0ZS1uZXh0LWFwcC1kaXIlMkZhcGklMkZ0eXBlQ2hhdCUyRnJvdXRlLnRzJmFwcERpcj0lMkZob21lJTJGcnVubmVyJTJGd29yayUyRmFzay1jb2RlYmFzZSUyRmFzay1jb2RlYmFzZSUyRnNyYyUyRmFwcCZhcHBQYXRocz0lMkZhcGklMkZ0eXBlQ2hhdCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!

../node_modules/.pnpm/typechat@0.0.10/node_modules/typechat/dist/interactive.js:8:35
Module not found: Can't resolve 'readline/promises'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
../node_modules/.pnpm/typechat@0.0.10/node_modules/typechat/dist/index.js
./app/api/typeChat/route.ts
../node_modules/.pnpm/next@13.4.6_@babel+core@7.22.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/webpack/loaders/next-edge-app-route-loader/index.js?absolutePagePath=private-next-app-dir%2Fapi%2FtypeChat%2Froute.ts&page=%2Fapi%2FtypeChat%2Froute&appDirLoader=bmV4dC1hcHAtbG9hZGVyP25hbWU9YXBwJTJGYXBpJTJGdHlwZUNoYXQlMkZyb3V0ZSZwYWdlPSUyRmFwaSUyRnR5cGVDaGF0JTJGcm91dGUmcGFnZVBhdGg9cHJpdmF0ZS1uZXh0LWFwcC1kaXIlMkZhcGklMkZ0eXBlQ2hhdCUyRnJvdXRlLnRzJmFwcERpcj0lMkZob21lJTJGcnVubmVyJTJGd29yayUyRmFzay1jb2RlYmFzZSUyRmFzay1jb2RlYmFzZSUyRnNyYyUyRmFwcCZhcHBQYXRocz0lMkZhcGklMkZ0eXBlQ2hhdCUyRnJvdXRlJnBhZ2VFeHRlbnNpb25zPXRzeCZwYWdlRXh0ZW5zaW9ucz10cyZwYWdlRXh0ZW5zaW9ucz1qc3gmcGFnZUV4dGVuc2lvbnM9anMmYmFzZVBhdGg9JmFzc2V0UHJlZml4PSZuZXh0Q29uZmlnT3V0cHV0PSZwcmVmZXJyZWRSZWdpb249Jm1pZGRsZXdhcmVDb25maWc9ZTMwJTNEIQ%3D%3D&nextConfigOutput=&preferredRegion=&middlewareConfig=e30%3D!


> Build failed because of webpack errors
 ELIFECYCLE  Command failed with exit code 1.
Error: Process completed with exit code 1.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/api/typeChat/route.ts and the import trace showing TypeChat's dist/index.js and dist/interactive.js during the Next.js edge build. Reproduce the production build, then verify that an edge-runtime route can use TypeChat without the reported fs and readline/promises resolution failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.