Moving this from https://github.com/sveltejs/sapper/issues/116#issuecomment-370153344 since that issue is closed by #153. If webpack emits non-JS assets for a route, Sapper will still generate a <script> tag for them:
<script src='/client/123xyz/main.css'></script>
I'm currently running into this, getting things like <script src=/client/fbd4e5d87f8d7dec1966/main.0.css> injected into the page when attempting to set up mini-css-extract-plugin to generate a global css file.
Expanding upon this, I also need to inject that CSS file into the head as a <link>. I'm using sapper-template as the base, which currently has no pre-defined CSS processing beyond what svelte provides. I've openned an issue about it there: https://github.com/sveltejs/sapper-template/issues/59
@Rich-Harris if we change https://github.com/sveltejs/sapper/blob/master/src/middleware.ts#L483 to .filter(function (file) { return file.match(/\.js$/); }), wouldn't this fix the inclusion of the css files in a script tag?
Most helpful comment
I'm currently running into this, getting things like
<script src=/client/fbd4e5d87f8d7dec1966/main.0.css>injected into the page when attempting to set upmini-css-extract-pluginto generate a global css file.Expanding upon this, I also need to inject that CSS file into the head as a
<link>. I'm using sapper-template as the base, which currently has no pre-defined CSS processing beyond what svelte provides. I've openned an issue about it there: https://github.com/sveltejs/sapper-template/issues/59