Skip to content

Using inlineStyleThreshold causes duplicate CSS #7130

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

Closed
The-Noah opened this issue Oct 3, 2022 · 3 comments
Closed

Using inlineStyleThreshold causes duplicate CSS #7130

The-Noah opened this issue Oct 3, 2022 · 3 comments
Labels
bug Something isn't working vite
Milestone

Comments

@The-Noah
Copy link
Contributor

The-Noah commented Oct 3, 2022

Describe the bug

When I add inlineStyleThreshold to my svelte.config.js file it duplicates the CSS; it is both inline and imported via link tags. The link tags have both the disabled property and media="(max-width: 0)" which would make me think they shouldn't be loaded (and if that's the case I don't know why it's included at all) but when I go to the network tab in devtools it shows the styles being loaded

No inlineStyleThreshold

image

inlineStyleThreshold

image
image

Reproduction

Repo: https://github.com/The-Noah/sveltekit-inline-css

Steps to reproduce

  1. Download and build application
git clone https://github.com/The-Noah/sveltekit-inline-css.git
cd sveltekit-inline-css
pnpm i
pnpm build
  1. Open build/index.html to find the inline CSS and CSS import.

Logs

No response

System Info

System:
  OS: Windows 10 10.0.25211
  CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
  Memory: 15.29 GB / 31.92 GB
Binaries:
  Node: 17.4.0 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
  npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Spartan (44.25211.1001.0), Chromium (104.0.1293.47)
  Internet Explorer: 11.0.25211.1001
npmPackages:
  @sveltejs/adapter-static: 1.0.0-next.44 => 1.0.0-next.44
  @sveltejs/kit: next => 1.0.0-next.507
  svelte: ^3.44.0 => 3.50.1
  vite: ^3.1.0 => 3.1.4

Severity

annoyance

Additional Information

No response

@dummdidumm dummdidumm added the bug Something isn't working label Nov 3, 2022
@dummdidumm dummdidumm added this to the 1.0 milestone Nov 3, 2022
@dummdidumm dummdidumm added the vite label Nov 4, 2022
@dummdidumm
Copy link
Member

This seems to have been a bug in Vite. It fails with 3.1.x, but works with 3.2.x. Updating to the latest version of Vite fixes the bug.

@Rican7
Copy link

Rican7 commented Mar 21, 2025

Hmm, I'm running into this same issue now, with Vite 6.2.2.

@The-Noah
Copy link
Contributor Author

I've just noticed the same issue again as well. SvelteKit v2.19.2 and Vite v6.2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vite
Projects
None yet
Development

No branches or pull requests

3 participants