vue-email / nuxt

💚 Official Nuxt module for Vue Email. Build email templates with Vue components.
https://vuemail.net/getting-started/nuxt-nitro
MIT License
110 stars 3 forks source link

Cannot compile server on cloudflare_pages #12

Closed iBobik closed 11 months ago

iBobik commented 11 months ago

When build for Cloudflare (all its presets) it will fail on "externals are not allowed".

import { useCompiler } from '#vue-email';

export default defineEventHandler(async (handler) => {
  const template = await useCompiler('TestTemplate.vue');
  return { template };
});

This is from reproduction here: https://stackblitz.com/edit/github-nevpij?file=server%2Fapi%2Ftest-mail.ts

❯ 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!
Flowko commented 11 months ago

duplicate of https://github.com/vue-email/nuxt/issues/2