Akryum / Akryum/vue-cli-plugin-ssr

Duplicated CSS rules in production

オープン
#46 コメント 15 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
441
フォーク
69
PR マージ指標
30日以内にマージされた PR はありません

説明

When using this CLI plugin, there are duplicated CSS rules when using CSS modules and the "composes" feature. This seems to be caused by the critical CSS that's inlined into the `` and is both happening in development and production (main issue).

I've created the following test repo (https://github.com/mrksbnch/vue-ssr-css-issue) that I created using `vue create` (Vue router as the only feature) and `vue add @akryum/vue-cli-plugin-ssr`. Afterwards, I added a test.css file in the folder `assets` and composed (``) two style declarations from that file in `Home.vue` and `HelloWorld.vue`.

You can see the duplicated rules after running `npm run ssr:serve` or `npm run ssr:build` and `npm run ssr:start` in the dev tools:

<img width="1279" alt="screen shot 2019-01-06 at 18 32 42" src="https://user-images.githubusercontent.com/15638734/50739619-6fa76300-11e3-11e9-863c-268dabad673a.png">

Both CSS rules are inlined on the server side (`<style data-vue-ssr-id>`):

<img width="554" alt="screen shot 2019-01-06 at 18 33 20" src="https://user-images.githubusercontent.com/15638734/50739658-b6955880-11e3-11e9-970f-d8cad662c4ff.png">

This is just a simple test repo with only one CSS rule. In a proper app this will cause a lot (!) of duplicated CSS rules and increase the file size by quite a bit. I've tested it with a simple app and I noticed some rules being duplicated 5 or 6 times.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。