freddy38510 / quasar-app-extension-ssg

Static Site Generator App Extension for Quasar.
MIT License
153 stars 16 forks source link

ERR_INVALID_ARG_TYPE #390

Closed yosa closed 4 months ago

yosa commented 4 months ago

When running quasar ssg generate it gives the error ERR_INVALID_ARG_TYPE.

Build mode............. ssg
 Pkg quasar............. v2.16.1
 Pkg @quasar/app-vite... v1.9.2
 Pkg vite............... v2.9.18
 Pkg ssg................ v5.1.1
 Debugging.............. no

 App •  WAIT  • Compiling of SSR Client with Vite in progress...
 App •  DONE  • SSR Client compiled with success • 2999ms

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Promise
    at writeFileSync (node:fs:2314:5)
    at SsgBuilder.writeFile (/Users/lheredia/projects/quasar/vue3/quasar-with-ssg/node_modules/@quasar/app-vite/lib/app-builder.js:35:5)
    at #writeRenderTemplate (/Users/lheredia/projects/quasar/vue3/quasar-with-ssg/node_modules/quasar-app-extension-ssg/src/vite/ssg-builder.js:119:10)
    at SsgBuilder.compile (/Users/lheredia/projects/quasar/vue3/quasar-with-ssg/node_modules/quasar-app-extension-ssg/src/vite/ssg-builder.js:42:36)
    at async run (/Users/lheredia/projects/quasar/vue3/quasar-with-ssg/node_modules/quasar-app-extension-ssg/src/vite/cmd/generate.js:101:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v18.18.2

Can someone share a solution with me?

codemeat commented 4 months ago

I have the same issue... have you made progress?

NunoSav commented 4 months ago

Same

yosa commented 4 months ago

I had to create project from scratch using webpack. the version with vite gives problems

yosa commented 4 months ago

I have the same issue... have you made progress?

I had to create project from scratch using webpack. the version with vite gives problems

NunoSav commented 4 months ago

I managed to fix the issue on my side, at least well enough to generate the static pages.

Changes made:

  1. this to if (true) to force compilation of render-template.js
  2. this to await transformProdSsgFallbackHtml(html, this.quasarConf), to provide html content instead of a Promise

I believe this was all I did. If you wish to do the same just make these changes within node_modules/quasar-app-extension-ssg.

freddy38510 commented 4 months ago

q/app-vite v1.8.3 introduced some breaking changes for this extension by changing some imported functions to async functions.

The fixes are available in the quasar-app-extension-ssg@5.2.0 release.

Sorry for not being quicker. I have very little time to maintain this extension. Hopefully, ssg mode should be natively supported by quasar in the more or less near future.

codemeat commented 4 months ago

@freddy38510 thank you