跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[JavaScript] error [vite]: Rollup failed to resolve import "node-fetch"

发表于

求解这个错误是什么原因导致的

github 上找的 blog 程序,本地运行正常,可以正常 build 输出,但是在 vercel cloudflare 这些平台上就报下面的错误,node 版本也设置了不行。

好像经常碰到 node-fetch 类的问题

 error   [vite]: Rollup failed to resolve import "node-fetch" from "/vercel/path0/src/lib/blog-helpers.ts".
22:49:46.923
  This is most likely unintended because it can break your application at runtime.
22:49:46.923
  If you do want to externalize this module explicitly add it to
22:49:46.924
  `build.rollupOptions.external`
22:49:46.924
Error: [vite]: Rollup failed to resolve import "node-fetch" from "/vercel/path0/src/lib/blog-helpers.ts".
22:49:46.924
This is most likely unintended because it can break your application at runtime.
22:49:46.924
If you do want to externalize this module explicitly add it to
22:49:46.924
`build.rollupOptions.external`
22:49:46.924
    at viteWarn (file:///vercel/path0/node_modules/.pnpm/vite@4.5.3/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48216:27)
22:49:46.924
    at onRollupWarning (file:///vercel/path0/node_modules/.pnpm/vite@4.5.3/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48248:9)
    ```

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.