Skip to content

Windows: css not loaded on navigation #606

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
aloker opened this issue Mar 23, 2021 · 5 comments · Fixed by #1096
Closed

Windows: css not loaded on navigation #606

aloker opened this issue Mar 23, 2021 · 5 comments · Fixed by #1096
Labels
bug Something isn't working
Milestone

Comments

@aloker
Copy link
Contributor

aloker commented Mar 23, 2021

Describe the bug
When navigating from one page to another, the css of the second page is not loaded. This only happens when building the app on Windows, on Linux (WSL2 on Windows), the css file is correctly loaded.

I've created a simple repo for reproduction: https://github.com/aloker/svelte-kit-issue-load-on-nav

First page:
image

A click on "To page 2" shows this on WSL2:
image
Network requests (notice the css for page2 at the enc):
image

And this on Windows (missing the styling):
image
Network requests (no css for page2):
image

Logs
There are no errors in the console

To Reproduce

Expected behavior
CSS files should be loaded for pages

Information about your SvelteKit Installation:

Windows:
System:
OS: Windows 10 10.0.19042
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 18.54 GB / 31.81 GB
Binaries:
Node: 14.16.0 - c:\tools\node\node.EXE
Yarn: 1.22.10 - c:\tools\node\yarn.CMD
npm: 7.6.3 - c:\tools\node\npm.CMD
Browsers:
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.57)
Internet Explorer: 11.0.19041.1
npmPackages:
@sveltejs/kit: next => 1.0.0-next.55
svelte: ^3.29.0 => 3.35.0

Linux:
System:
OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 23.83 GB / 24.91 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.16.0 - /usr/bin/node
Yarn: 1.22.10 - /mnt/c/tools/node/yarn
npm: 7.7.0 - /usr/bin/npm
npmPackages:
@sveltejs/kit: next => 1.0.0-next.55
svelte: ^3.29.0 => 3.35.0

Tested on latest Firefox, Chrome and Vivaldi browsers

Tested with node and static adapters with same result.

Severity
Show stopper for pure Windows development, although when using WSL2 it works fine.

@aloker aloker changed the title Windows: css not loaded on transition Windows: css not loaded on navigation Mar 23, 2021
@benmccann benmccann added the bug Something isn't working label Mar 26, 2021
@benmccann benmccann added this to the 1.0 milestone Apr 13, 2021
@stephane-vanraes
Copy link
Contributor

I am running into a similar issue after build on a dockerized linux instance

@Kapsonfire-DE
Copy link
Contributor

In fact, the SSR version works. The CSS is injected on SSR request. (navigate to page2 and reload browser)
But on the client module code, the CSS is never mentioned/injected.

@stephane-vanraes
Copy link
Contributor

As a potential workaround for this you can extract all the css, bundle it up and serve it statically:

in svelte.config.js

const css = require('rollup-plugin-css-only');

module.exports = {
   kit: {
     vite: {
        plugins: [
           css({ output: 'bundle.css' })
	]
     }
  }
}

and to serve it, in app.html add a reference to the header

<link rel="stylesheet" href="/./_app/bundle.css">

@frederikhors
Copy link
Contributor

It works until v70.

These are the commits between 69 and 70:

Perhaps the fault of the latter.

@frederikhors
Copy link
Contributor

It works today with 79.

I think we can close this, @aloker.

@GrygrFlzr GrygrFlzr linked a pull request Apr 18, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants