Next-plugins: Styles not loaded.

Created on 25 May 2018  Β·  11Comments  Β·  Source: vercel/next-plugins

Im using Next Js 6.0.x

When Im in Dev Mode my Stiles are loaded fine (im using sass)

But when I create a Build, Styles doest loaded, someone knows something about that??

Most helpful comment

@markolofsen @aequasi
I have the same issue too. But I soon found that the reason of styles not loading while using react routing in dev mode, might be using multi type of css languages. In my case I used sass and css in the same _document.js. Problem was saolved when I only use sass.

I think the config might be related to the problem. Here's my config in next.config.js:

const withCSS = require('@zeit/next-css')
const withSass = require('@zeit/next-sass')
const commonsChunkConfig = require('@zeit/next-css/commons-chunk-config')

const config = withCSS(withSass({
  webpack: (config, {isServer}) => {
    if (!isServer) {
      config = commonsChunkConfig(config, /\.(sass|scss|css)$/)
    }
    return config
  }
}))

module.exports =  config

All 11 comments

Might be related to #177

I'm having the same issue, but using Postcss.

@jakeleboeuf the fix for plain css seemed to be to move the import to the page level, and not in the _document file, maybe this will work for postcss as well?

make sure you update @zeit/next-sass and @zeit/next-css to 0.2.0, solves this issue

None of the solutions worked for me. I got the problem when I use "node server.js". The style.css file is not created, only using in dev mode "next". I am also using sass.

Any updates on this one? I have the same issue ? @and3rsonsousa

Same issue

What do you guys ee when you type npm ls @zeit/next-sass and npm ls @zeit/next-css?

npm ls @zeit/next-sass
└── @zeit/[email protected]

npm ls @zeit/next-css

β”œβ”€β”€ @zeit/[email protected]
└─┬ @zeit/[email protected]
  └── @zeit/[email protected]  deduped

@markolofsen @aequasi
I have the same issue too. But I soon found that the reason of styles not loading while using react routing in dev mode, might be using multi type of css languages. In my case I used sass and css in the same _document.js. Problem was saolved when I only use sass.

I think the config might be related to the problem. Here's my config in next.config.js:

const withCSS = require('@zeit/next-css')
const withSass = require('@zeit/next-sass')
const commonsChunkConfig = require('@zeit/next-css/commons-chunk-config')

const config = withCSS(withSass({
  webpack: (config, {isServer}) => {
    if (!isServer) {
      config = commonsChunkConfig(config, /\.(sass|scss|css)$/)
    }
    return config
  }
}))

module.exports =  config

@webtjw yes, I I prefered css in js instead sass β€”Β that's work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kyle-Mendes picture Kyle-Mendes  Β·  4Comments

tim-phillips picture tim-phillips  Β·  4Comments

Jungwoo-An picture Jungwoo-An  Β·  4Comments

sebas-deedee picture sebas-deedee  Β·  3Comments

asicfr picture asicfr  Β·  3Comments