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

Cannot find email template after nuxt build #13

Closed
vosamoilenko opened this issue Jan 7, 2024 · 4 comments
Closed

Cannot find email template after nuxt build #13

vosamoilenko opened this issue Jan 7, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@vosamoilenko
Copy link

Environment

  • OS: macOS Sonoma 14.2.1
  • Node: v18.18.2
  • pnpm: 8.13.1

Package deps

  • Nuxt: 3.9.0
  • vue: 3.4.5
  • vue-email/nuxt: 0.8.7

Issue description

The vue-email/nuxt works great when I'm running pnpm dev. As soon I do pnpm build && pnpm start I see the error in console:

Error loading component node:internal/modules/cjs/loader:573
      throw e;
      ^

Error: Cannot find module '/Users/vo1/Developer/vue-email-repro-missing-component/vue-email-repro-missing-component/.output/server/node_modules/vue-email/dist/index.cjs'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
    at resolveExports (node:internal/modules/cjs/loader:567:14)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at /Users/vo1/Developer/vue-email-repro-missing-component/vue-email-repro-missing-component/.output/server/node_modules/import-string/dist/wlflv5w9v8m5WT2r6LTqd.js:36:24
    at Script.runInContext (node:vm:135:12) {
  code: 'MODULE_NOT_FOUND',
  path: '/Users/vo1/Developer/vue-email-repro-missing-component/vue-email-repro-missing-component/.output/server/node_modules/vue-email/package.json'
}
[nuxt] [request error] [unhandled] [500] Error rendering template Test: Error: Component Test not found
  at templateRender (./server/node_modules/@vue-email/compiler/dist/index.mjs:57013:11)  
  at async useCompiler (./server/chunks/generate.post.mjs:27:20)  
  at async ./server/chunks/generate.post.mjs:39:20  
  at async Object.handler (./server/chunks/nitro/node-server.mjs:2203:19)  
  at async toNodeHandle (./server/chunks/nitro/node-server.mjs:2392:7)  
  at async ufetch (./server/chunks/nitro/node-server.mjs:2758:17)  
  at async $fetchRaw2 (./server/chunks/nitro/node-server.mjs:2630:26)  
  at async $fetch2 (./server/chunks/nitro/node-server.mjs:2672:15)  
  at async setup (./server/chunks/app/server.mjs:810:19)

Minimal repo is attached for repro.
vue-email-repro-missing-component.zip

@adrienZ
Copy link

adrienZ commented Jan 8, 2024

I have the same error on this stackblitz: https://stackblitz.com/edit/github-usvs6j?file=nuxt.config.ts

/api/email

@Flowko Flowko added the bug Something isn't working label Jan 9, 2024
@Flowko Flowko self-assigned this Jan 9, 2024
@Flowko
Copy link
Member

Flowko commented Jan 9, 2024

if you can both upgrade to 0.8.8 , clean node_modules and lock files please

@vosamoilenko please use stackblitz for code, i wont download that file, also
@adrienZ it should resolve the component issue, but also i noticed that you are importing vue-email components in the test.vue file, you shouldnt do that, the components of the library are auto imported, also, you will face another issue with the baseUrl you should only use the base Url if you gonna use it for images

https://stackblitz.com/edit/github-usvs6j-5oeyxy?file=package.json,emails%2Ftest.vue,nuxt.config.ts

i updated the base url and update the img src, will open another issue related to this speciifc image issue

@adrienZ
Copy link

adrienZ commented Jan 9, 2024

if you can both upgrade to 0.8.8 , clean node_modules and lock files please

@vosamoilenko please use stackblitz for code, i wont download that file, also @adrienZ it should resolve the component issue, but also i noticed that you are importing vue-email components in the test.vue file, you shouldnt do that, the components of the library are auto imported, also, you will face another issue with the baseUrl you should only use the base Url if you gonna use it for images

https://stackblitz.com/edit/github-usvs6j-5oeyxy?file=package.json,emails%2Ftest.vue,nuxt.config.ts

i updated the base url and update the img src, will open another issue related to this speciifc image issue

upgrading and removing imports from vue-email fixed it, thanks @Flowko !

@Flowko Flowko closed this as completed Jan 12, 2024
@eBrou
Copy link

eBrou commented Jan 12, 2024

@Flowko Hi. First, thank you for your work on this module!

I'm looking into a similar issue and it has not been solved by upgrading to 0.8.8.
I'm also seeing that the stackblitz linked above still has the same error, even with the updated version. (If that link isn't adequate I can look into creating a separate stackblitz soon)

Could you please advise?
Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants