CSS from SFC's is not supplied on SSR with the initial response
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript, webpack
- Domain
- build-system, frontend
Research direction
Start with the linked CodeSandbox, especially src/components/TestComponent.vue, quasar.conf.js, and routes.js. Reproduce the SSR response with JavaScript disabled, then inspect the webpack plugin behavior around the lazy-loaded Index.vue route. Done means the SFC CSS appears in the initial SSR response without adding Index.vue to the main bundle.
Written by the indexing model from the issue text.
Description
I have been breaking my head the past 2 hours on a problem which I cannot wrap my head round. When I use unplugin-auto-import with Quasar (webpack) the css that I define in <style> tags inside SFC child components is no longer supplied with the SSR initial response.
I have no idea why but if I remove the unplugin-auto-import plugin from webpack, things work normally again. Luckely I was able to create a reproducing example, see here:
https://codesandbox.io/s/fragrant-meadow-8g5dy?file=/src/components/TestComponent.vue
To see the problem:
- Open the browser from the sandbox in a new tab
- In this new tab, disable javascript (In chrome devtools you can do
Ctrl + shift + pand typedisableand you will see aDisable javascriptcommand - Reload the page, now the div in there with text
This element should be redis not red - If you inspect the source (
Ctrl + u) you can see that there is no css imported
To make it work again:
- Comment out the lines in
quasar.conf.jsthat add the plugin - Restart the dev server and follow the steps above to see the difference.
What also makes it work again:
- Change the
routes.jsfile, addimport Index from 'pages/Index.vueat the top. - Change
component: () => import('pages/Index.vue')tocomponent: Index
But this is not really an option because that would include Index in the main bundle and I want to be able to split that page into a seperate bundle, only loaded when required.
Do you have any idea what could be the problem here? I cannot see a logical reason for why this might happen but I don't have a knowledge of the plugin's internals and how it does what it does.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from unplugin/unplugin-auto-import
-
need reproduction
Difficulty 4/5 3-5 days Newbie friendliness 35/100
unplugin/unplugin-auto-import#623 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
unplugin/unplugin-auto-import#620 · 1 comment · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
unplugin/unplugin-auto-import#619 · 4 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
unplugin/unplugin-auto-import#618 · 7 comments · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
unplugin/unplugin-auto-import#617 ·
All issues in unplugin/unplugin-auto-import
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·