vuejs / vue-loader

📦 Webpack loader for Vue.js components
MIT License
4.99k stars 915 forks source link

fix: add tests for SSR render #2083

Open niksy opened 3 months ago

niksy commented 3 months ago

This PR continues on the work of https://github.com/vuejs/vue-loader/pull/2079 by adding missing tests removed in https://github.com/vuejs/vue-loader/commit/20352da36bf5e37b761ab48971f25f194e6dac7c and based on implementation at v15 version of loader.

SSR context styles are not present since I couldn’t get final result inside context. As I see it, that currently isn’t possible since all the CSS is automatically extracted, but maybe it could be achivede with additional loader after all the CSS has been preprocessed?

v15 version relies on vue-style-loader so I think that’s why it was possible to get all the necessary information.

Also, hashing function from original PR has been moved from hash-sum to internal one to align with Vite and other hashing behavior. It’s possible that this could clash with Nuxt Vue client manifest package implementation.

@sodatea Is it possible we can get this implemented? This would greatly help with collecting all the necessary components needed for initial render in SSR contexts. After that, maybe we could work on critical CSS implementation.

OskarLebuda commented 1 week ago

Good job 👍🏻 I've done it myself but this requires fork of this repo. The official way should be provided. @yyx990803 @haoqunjiang approve this PR and make some release with that?

dmitryuk commented 1 week ago

Thanks for you PR! Waiting to be merged soon