Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waku build error when in monorepo #976

Closed
himself65 opened this issue Oct 18, 2024 · 8 comments
Closed

waku build error when in monorepo #976

himself65 opened this issue Oct 18, 2024 · 8 comments

Comments

@himself65
Copy link
Contributor

himself65 commented Oct 18, 2024

/Users/himself65/.local/state/fnm_multishells/1113_1729278934946/bin/npm run build

> [email protected] build
> waku build

vite v5.4.9 building SSR bundle for production...
✓ 1744 modules transformed.
✓ built in 1.64s
vite v5.4.9 building SSR bundle for production...
✓ 1808 modules transformed.
✓ built in 1.55s
vite v5.4.9 building SSR bundle for production...
✓ 1748 modules transformed.
x Build failed in 721ms
node:internal/modules/run_main:129
    triggerUncaughtException(
    ^

[commonjs--resolver] Failed to resolve entry for package "https". The package may have incorrect main/module/exports specified in its package.json.
    at packageEntryFailure (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Cyk9bIUq.js:46626:15)
    at resolvePackageEntry (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Cyk9bIUq.js:46623:3)
    at tryNodeResolve (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Cyk9bIUq.js:46439:16)
    at Object.resolveId (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Cyk9bIUq.js:46189:19)
    at Object.handler (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Cyk9bIUq.js:65642:15)
    at file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20730:40
    at async PluginDriver.hookFirstAndGetPlugin (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20630:28)
    at async resolveId (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19234:26)
    at async ModuleLoader.resolveId (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19663:15)
    at async Object.resolveId (file:///Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/lib/plugins/vite-plugin-rsc-managed.js:66:30) {
  code: 'PLUGIN_ERROR',
  pluginCode: 'ERR_RESOLVE_PACKAGE_ENTRY_FAIL',
  plugin: 'commonjs--resolver',
  hook: 'resolveId',
  watchFiles: [
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]_re_57bqax4kx4qy555si4htuvogkq/node_modules/react-server-dom-webpack/server.edge.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/client.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/router/client.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/pages/_layout.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/pages/note/[noteId].tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/pages/index.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/chat-list.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/editor.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/chat.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/external-link.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/footer.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/empty-screen.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/llamaindex.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/message.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/note-list-preview.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/header.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/new-note-button.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/note-title.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/minimal/client.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/avatar.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/card.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/button.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/badge.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/dropdown-menu.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/icons.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/input.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/label.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/separator.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/sheet.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/scroll-area.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/textarea.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/tooltip.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/toast.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_hgx56dh7nia42geircaluitsum/node_modules/@radix-ui/react-toast/dist/index.mjs',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected]_62aei3syvqh35hb77guppdwrdm/node_modules/ai/rsc/dist/rsc-shared.mjs',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/ai/provider.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/toaster.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/components/ui/use-toast.ts',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected][email protected]_62aei3syvqh35hb77guppdwrdm/node_modules/ai/rsc/dist/rsc-server.mjs',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/package.json',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/minimal/server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/middleware/context.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]_re_57bqax4kx4qy555si4htuvogkq/node_modules/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/react/jsx-runtime.react-server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/react-dom/react-dom.react-server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/react/react.react-server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/lib/middleware/context.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/styles.css',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/pages.gen.ts',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/store/client.ts',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/lib/hooks/chat-scroll-anchor.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/lib/hooks/use-at-bottom.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/lib/hooks/use-enter-submit.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/src/lib/utils/index.tsx',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/packages/www/tailwind.config.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/lucide-react.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/main.react-server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected]_reac_fvx3e6vn4nbvqunscnynkb2nbm/node_modules/waku/dist/router/server.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected]/node_modules/class-variance-authority/dist/index.mjs',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@radix-ui/react-slot/dist/index.mjs',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/a-arrow-down.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/a-arrow-up.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/accessibility.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/activity.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/index.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/air-vent.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/a-large-small.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/airplay.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/album.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/alarm-clock-off.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/alarm-smoke.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/alarm-clock.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-center-vertical.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-center-horizontal.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-center.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-end-horizontal.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-end-vertical.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-distribute-center.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-distribute-end.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-distribute-start.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-justify-end.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-justify-center.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-justify-start.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-space-around.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-horizontal-space-between.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-justify.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-left.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-right.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-start-horizontal.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-start-vertical.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-distribute-center.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-distribute-end.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-distribute-start.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-justify-center.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-justify-end.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-justify-start.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-space-around.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/align-vertical-space-between.js',
    '/Users/himself65/Code/how-to-create-llm-in-node.js/node_modules/.pnpm/[email protected][email protected]/node_modules/lucide-react/dist/esm/icons/ambulance.js',
    ... 1638 more items
  ]
}

Node.js v20.17.0

Process finished with exit code 1
@himself65
Copy link
Contributor Author

himself65 commented Oct 18, 2024

Add this file

"use server"
import OpenAI from "openai";

const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

@himself65 himself65 changed the title waku build error waku build error with openai Oct 18, 2024
@dai-shi
Copy link
Owner

dai-shi commented Oct 19, 2024

If it worked before, it seems like it’s due to the Vite upgrade.

@dai-shi
Copy link
Owner

dai-shi commented Oct 19, 2024

I wasn't able to reproduce the error with just adding ./src/components/func.ts and importing it from ./src/pages/index.tsx.

@himself65
Copy link
Contributor Author

@himself65 himself65 changed the title waku build error with openai waku build error when in monorepo Oct 19, 2024
@dai-shi
Copy link
Owner

dai-shi commented Oct 19, 2024

Is it related with #676 and #684? Sounds different.

@dai-shi
Copy link
Owner

dai-shi commented Oct 20, 2024

nailed down that this is affected with #764 change.

@himself65
Copy link
Contributor Author

workaround for now, as discussed in discord

$ cat packages/www/vite.config.ts 
export default () => {
  return {
    ssr: {
      resolve: {
        conditions: ["workerd"],
      },
    },
  };
};

@dai-shi
Copy link
Owner

dai-shi commented Dec 22, 2024

Do you still have the same issue with all latest versions?

#764 was a good change and if the workerd condition is only the reason of the issue, the suggested workaround is the real solution for now.

Closing this especially because it's not tied to monorepo issue.
If the problem persists, please open a new issue.

@dai-shi dai-shi closed this as completed Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants