vuejs / vue-loader

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

why ssr module registration was removed from v16 #1887

Open tcstory opened 3 years ago

tcstory commented 3 years ago

Version

16.8.1

Reproduction link

github.com

Steps to reproduce

i have no idea why the functionality was removed. it's very important for ssr rendering.

vitejs/plugin-vue and vue-loader are both plugins, why vitejs/plugin-vue has this functionality but vue-loader doesnt

What is expected?

ssr module registration should be support

What is actually happening?

ssr module registration was removed

haoqunjiang commented 3 years ago

Please be more specific. I don't understand what you mean by "ssr module registration"

tcstory commented 3 years ago

sorry.

version 15.x of vue-loader will use the following code to add the component during ssr rendering, the code is located in lib/runtime/componentNormalizer.js

// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
  context._registeredComponents.add(moduleIdentifier)
}
haoqunjiang commented 3 years ago

Oh, that was a planned but not yet implemented feature. As you can see, the SSR tests are still listed as TODOs.

Thanks for bringing this up. I'll see if I can implement it when I have time.

Contributions are also welcome.

phoenix-ru commented 3 years ago

Hi @sodatea. I've implemented critical CSS collection in https://github.com/phoenix-ru/vue-loader.

However, my solution assumes that vue-style-loader is used (as with v15). Can you verify if that's acceptable or v16 dropped vue-style-loader for a reason?

If that solution is fine, I can open a PR and polish it

BlackCubeNo99 commented 2 years ago

Oh, that was a planned but not yet implemented feature. As you can see, the SSR tests are still listed as TODOs.

Thanks for bringing this up. I'll see if I can implement it when I have time.

Contributions are also welcome.

Does anyone have a work around? @sodatea

dmitryuk commented 2 weeks ago

Hello, any plans?

OskarLebuda commented 1 week ago

Hello, any plans?

@dmitryuk I don't think so. There is a open PR since August by @niksy https://github.com/vuejs/vue-loader/pull/2083 But @yyx990803, @haoqunjiang or any other contributors doesn't care about it. The fork is the only way I think.

It will be only worst. The rolldown comming up, so I think they will drop support for Webpack any time soon. Last commit in this repo was 10 months ago.

We've made a fork for our purposes, add patch by niks and seams to work fine for us.

niksy commented 1 week ago

This is really unfortunate becuase Vue loader will probably still be actively used because of Rspack and it’s Vue support.

The other solution (and probably best approach) can be unplugin-vue, but it’s missing HMR support for Webpack/Rspack.