vue-email / nuxt

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

Compiler broken in Nuxt (build) #1

Closed vanling closed 7 months ago

vanling commented 8 months ago

Node 20 / Nuxt 3.8.2

Installed vue-email, @vue-email/nuxt and even vue-i18n (different issue, nuxt wont start without vue-i18n) I tried it with multiple 0.8.0 beta versions, no luck.

Error shows when doing 'npm run build' In dev mode it all works.

My last attempt was only using "@vue-email/compiler": "^0.8.0-beta.8", and that resulted in same error


 ERROR  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type function ([Function (anonymous)])                                 nitro 2:47:15 PM

undefined

 ERROR  The "path" argument must be of type string. Received type function ([Function (anonymous)])                                                                         2:47:15 PM

  at new NodeError (node:internal/errors:406:5)
  at validateString (node:internal/validators:162:11)
  at Function.join (node:path:1175:7)
  at Object.mockPath [as then] (node_modules/@vercel/nft/out/analyze.js:168:27) 

 ERROR  The "path" argument must be of type string. Received type function ([Function (anonymous)])```
oscarmartins commented 8 months ago

In the same situation..

oscarmartins commented 8 months ago

@vanling any idea how we can overcome this little problem? Thanks.

vanling commented 8 months ago

@oscarmartins not yet unfortunately :(

Love this module, hope it's working soon.. would rather not make that email-html by hand 😂 Changing some codebases like this for now.

// import { useCompiler } from '#vue-email'
  const template = `${name} (${email}) send message:<br><br>${message}}`  // await useCompiler('contact-form.vue', {
  //   ...body,
  // })
oscarmartins commented 8 months ago

@vanling 😂 I love this module too. Hope it's up and running soon. Crafting email HTML by hand feels like a journey back in time! ðŸ‘Đ‍ðŸ’ŧâœĻ Making some code changes for now...ðŸĪŠ

dbudano commented 8 months ago

I had the same issue. It seems to come from the last version of vue/compiler-sfc and not vue-email. I solved it by overriding vue version of Nuxt to 3.3.8.

oscarmartins commented 8 months ago

@dbudano, appreciate the suggestion! However, I'm currently on Nuxt version 3.8.1.

@Dave136, do you happen to have any suggestions on how to work around this situation?

oscarmartins commented 8 months ago

@dbudano , my apologies for the misunderstanding. I initially misinterpreted it, thinking it was related to the Nuxt version. If it's not too much to ask, would it be possible to share the configuration you have in nuxt.config and the versions of the modules you are using?

dbudano commented 8 months ago

@oscarmartins, I think you misunderstood...

You have to override the Vue version that Nuxt is using. You can edit your package.json

{
   ...
  "dependencies": {
    ...
    "vue": "3.3.8",
  },
  "overrides": {
    "@nuxt/devtools": {
      "vue": "3.3.8"
    },
    "nuxt": {
      "vue": "3.3.8"
    }
}

It allows me to build again while we are waiting for a fix. To be sure, I have also deleted lock files and node_modules.

Kephas3 commented 8 months ago

Hello,

Build works with this workaround but at the launch of the app, this error et throwned :

[nuxt] [request error] [unhandled] [500] Cannot find module '/Users/app/.output/server/node_modules/vue/server-renderer/index.mjs' imported from /Users/app/.output/server/chunks/handlers/renderer.mjs

Also i'v noticed that this WARN is shown during the build :

â„đ .nuxt/dist/client/_nuxt/entry.a6709859.js                        621.99 kB │ gzip: 218.63 kB                                                                                                    8:56:22 AM

 WARN                                                                                                                                                                                              8:56:22 AM
(!) Some chunks are larger than 500 kBs after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
Flowko commented 7 months ago

@dbudano thanks for ur reply, it helped me figure out what was causing it, we fixed it on the new version, not yet published, but will let you guys know once its done

Flowko commented 7 months ago

fixed in 0.8.0, please upgrade and let us know

vanling commented 7 months ago

I can check monday morning <3 thanks for the hard work!

romainpauli commented 7 months ago

Thank you very much, I just updated and it works !

Flowko commented 7 months ago

just as a note here, u no longer need vue-i18n installed, it should work without it just fine