frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
830 stars 92 forks source link

Build error with plugin legacy #63

Closed kadiryazici closed 3 years ago

kadiryazici commented 3 years ago

If you use @vitejs/plugin-legacy in the project and try to build server, this error occures

A:\Desktop\VUE\kyzc-portfolio\node_modules\.pnpm\vite-ssr@0.10.6_1875ae38a9ea4201aa9b0ba5cafe20a3\node_modules\vite-ssr\build\index.js:20
    const indexHtml = clientResult.output.find((file) => file.type === 'asset' && file.fileName === 'index.html');
                                          ^

TypeError: Cannot read property 'find' of undefined
    at module.exports (A:\Desktop\VUE\kyzc-portfolio\node_modules\.pnpm\vite-ssr@0.10.6_1875ae38a9ea4201aa9b0ba5cafe20a3\node_modules\vite-ssr\build\index.js:20:43)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async A:\Desktop\VUE\kyzc-portfolio\node_modules\.pnpm\vite-ssr@0.10.6_1875ae38a9ea4201aa9b0ba5cafe20a3\node_modules\vite-ssr\cli.js:19:9
 ERROR  Command failed with exit code 1.
kadiryazici commented 3 years ago

Legacy compiles client side values correctly but it tries to compile server too.

frandiox commented 3 years ago

This was mentioned in https://github.com/frandiox/vite-ssr/discussions/58

@johnRivs I managed to reproduce the issue finally 😅