Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue SFCs prevent Tailwind from generating CSS classes with vite-plugin-ssr #9587

Closed
7 tasks done
AaronBeaudoin opened this issue Aug 8, 2022 · 2 comments
Closed
7 tasks done

Comments

@AaronBeaudoin
Copy link

Describe the bug

When using vite-plugin-ssr with a page in "client-only" mode (by changing the filename from .page.vue to .page.client.vue), Tailwind cannot seem to generate new classes. See instructions provided in the linked repo.

I believe this issue is related to @vitejs/plugin-vue and not vite-plugin-ssr or Tailwind because everything works fine as long as the page file is a .page.client.js or some other extension and not a .page.client.vue Vue SFC file. I posted the issue here instead of vuejs/core because even when using a SFC file, everything works when just doing .page.vue (not doing "client-only" mode).

Reproduction

https://github.com/AaronBeaudoin/vite-issue-vue-sfc-tailwind

System Info

System:
    OS: macOS 12.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 80.53 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.134
    Safari: 15.1
  npmPackages:
    @vitejs/plugin-vue: ^3.0.1 => 3.0.1 
    vite: ^3.0.2 => 3.0.2

Used Package Manager

npm

Logs

No response

Validations

@brillout
Copy link
Contributor

For more context, this how vite-plugin-ssr treats .page.vue and .page.client.vue files:

<!-- /pages/about.page.vue -->
<template>
  <h1>About</h1>
  <p>
    This page is:
  </p>
  <ul>
    <li>Loaded and rendered to HTML on the sever-side (SSR).</li>
    <li>Loaded and rendered (hydrated) in the browser.</li>
  </ul>
</template>

If the user defines about.page.client.vue instead of about.page.vue:

<!-- /pages/about.page.client.vue -->
<template>
  <h1>About</h1>
  <p>
    This page is:
  </p>
  <ul>
    <li>Only loaded and rendered in the browser.</li>
    <li>Is is <em>not</em> loaded on the server-side (and therefore not rendered to HTML).</li>
  </ul>
</template>

This is how vite-plugin-ssr enables the user to have SPA pages as well SSR pages.

In addition to what Aaron wrote, we believe it's a problem related to @vitejs/plugin-vue also because Tailwind works when using React instead of Vue: https://github.com/brillout/vite-plugin-ssr_tailwind-css.

@sapphi-red
Copy link
Member

By applying #9341 (comment), it worked.
So it's happening by the same reason with #9341.
Closing to keep a single discussion going.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants