❯ NITRO_PRESET=cloudflare_pages npm run build
…
ℹ Building Nitro Server (preset: cloudflare_pages) nitro 0:38:34
(node-resolve plugin) Could not resolve import "unenv/runtime/mock/proxy-cjs/" in /home/projects/aoniabybg.github/node_modules/tough-cookie/lib/cookie.js using exports defined in /home/projects/aoniabybg.github/node_modules/unenv/package.json.
(node:105) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./runtime/mock/proxy-cjs/" in the "exports" field module resolution of the package at /home/projects/aoniabybg.github/node_modules/unenv/package.json imported from /home/projects/aoniabybg.github/node_modules. Mapping specifiers ending in "/" is no longer supported.
(Use `node --trace-deprecation ...` to show where the warning was created)
[nitro 0:38:42] ERROR Error: Cannot resolve "canvas" from "/home/projects/aoniabybg.github/node_modules/jsdom/lib/jsdom/utils.js" and externals are not allowed!
undefined
[0:38:42] ERROR Cannot resolve "canvas" from "/home/projects/aoniabybg.github/node_modules/jsdom/lib/jsdom/utils.js" and externals are not allowed!
at resolveId (node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:2005:17)
[0:38:42] ERROR Cannot resolve "canvas" from "/home/projects/aoniabybg.github/node_modules/jsdom/lib/jsdom/utils.js" and externals are not allowed!
~/projects/aoniabybg.github 16s
But in my custom project it complains about different libs:
[nitro 12:47:50 AM] ERROR Error: Cannot resolve "pnpapi" from "/Users/Bobik/Docker/thebeast/node_modules/esbuild/lib/main.js" and externals are not allowed!
undefined
[12:47:50 AM] ERROR Cannot resolve "pnpapi" from "/Users/Bobik/Docker/thebeast/node_modules/esbuild/lib/main.js" and externals are not allowed!
at Object.resolveId (node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:1973:17)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/rollup/dist/es/shared/node-entry.js:18539:28)
at async resolveId (node_modules/rollup/dist/es/shared/node-entry.js:17208:26)
at async ModuleLoader.resolveId (node_modules/rollup/dist/es/shared/node-entry.js:17622:15)
at async node_modules/@rollup/plugin-commonjs/dist/es/index.js:785:16
at async Promise.all (index 3)
at async node_modules/@rollup/plugin-commonjs/dist/es/index.js:777:32
at async rewriteRequireExpressionsAndGetImportBlock (node_modules/@rollup/plugin-commonjs/dist/es/index.js:1354:28)
at async transformCommonjs (node_modules/@rollup/plugin-commonjs/dist/es/index.js:1928:23)
at async transform (node_modules/rollup/dist/es/shared/node-entry.js:17540:16)
[12:47:50 AM] ERROR Cannot resolve "pnpapi" from "/Users/Bobik/Docker/thebeast/node_modules/esbuild/lib/main.js" and externals are not allowed!
When build for Cloudflare (all its presets) it will fail on "externals are not allowed".
This is from reproduction here: https://stackblitz.com/edit/github-nevpij?file=server%2Fapi%2Ftest-mail.ts
But in my custom project it complains about different libs: