Skip to content

Vue SSR render initial css chunks correctly #7897

Closed
@clarkdo

Description

@clarkdo

What problem does this feature solve?

Now webpack4 mini-css-extract-plugin supports css async-loading and splitted chunks, it also has been supported in vue-loader-15

But when we use it in ssr, it will still get all css files at ssr rendering.

Through my investigation, current vue-ssr webpack plugin will not generate corresponding css into initial and async inside vue-ssr-client-manifest.json.
https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/client.js#L19-L26

And also renderer renderStyles will render all css which includes splitted async css chunks.
https://github.com/vuejs/vue/blob/dev/src/server/template-renderer/index.js#L112

What does the proposed API look like?

css - initial chunks are in initial
css - spiltted chunks are in async
context.renderStyles() return all initial chunks
mini-css-extract-plugin will auto load async chunks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions