Unable to apply CSS or load JS files when deploying to Vapid


#1

Hi. I’m having trouble deploying my first site with Vapid.
Seems like the CSS and JS files are not being applied/uploaded when self hosting using vapid deploy .
Everything works fine while on development.

From the console : Refused to apply style from 'https://XPTO.vapid.site/stylesheets/site.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. .
Also javascripts/site.js cannot be found (404).
Other assets are being uploaded correctly into Vapid CDN.

My folder structure

www/
  index.html
  javascripts/
    site.pack.js
  stylesheets/
    site.pack.scss
    ...
  images/
    ...
  sounds/
    ...
  fonts/
    ...

My index.html import tags
<link rel="stylesheet" type="text/css" href="/stylesheets/site.css">
<script src="/javascripts/site.js"></script>

Your Environment
Include relevant details, so others can replicate the issue.

  • OS: OS X 10.11.6
  • Browser: Chrome
  • Node Version: 8.5.0
  • Vapid Version: ^0.3.0

#2

@vascogaspar The “MIME type” error is misleading—it’s actually a 404 but the error page itself has the wrong MIME type. i.e., Both your site.js and site.css are 404ing.

I’m wondering if it has something to do with your Node version. Technically, vapid-cli requires Node.js v8.9.0 or higher. Maybe that’s a good place for us to start. If upgrading to >=8.9 doesn’t work, I have a few other things for us to try.


#3

Hi @scott. I’ll update node and let you know. I am also using some external js dependencies via package.json, don’t know if that can cause some issues at this point. My SCSS is also split into separate files and imported in site.pack.scss

ttyl :v:


#4

Good to know, thanks. I imagine it might be one of the external dependencies that’s causing the asset compile to fail during deploy. Not through any fault of your own—probably just a bug.

If upgrading Node doesn’t work, email hello@vapid.com, so we can continue to troubleshoot and share site files privately.