求解这个错误是什么原因导致的
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)
```
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.