question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SOLVED: Incorrect CSS import order

See original GitHub issue

EDIT SOLUTION: It’s simply because the base styling is imported after routes in the main.js file and therefore overrides the css imported with the components.

Hi, it seems that the css is being built in the wrong order. My understanding would be that base.css should be at the top of the stylesheet and then any other css in the components would be at the bottom, overriding the top. Any easy way to test this is to add this line to style.css in the login folder

h1{
    color: #00FF00;
}

It should override to the new color, but it actually stays its original color.

We can see that this style has been applied to the heading, but the css in base.css has overriden it. I had this issue in my project when trying to import bootstrap, and everything was in reverse order of where I wanted it to be. I found this issue had always been in the project by going back to an empty essential-react project.

I have spent many hours trying to debug this while also trying to learn webpack.

Edit: The below issues were different and led me on the wrong path to trying to fix it I have seen this issue in many places, but have not been able to fix it from these, despite trying to disable extract-text-webpack, etc. https://github.com/webpack/extract-text-webpack-plugin/issues/57 https://github.com/webpack/webpack/issues/215

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
scottanglrcommented, Mar 17, 2016

I solved it by moving the import statement for the base styling import './common/base.css'; BEFORE the import statement for Routes import Routes from './common/components/Routes';.

0reactions
Memoyrcommented, Feb 7, 2017

an another specification : you also need use import instead of require() statement thanks so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS import order does not match the browser #5840 - GitHub
I am the main developer for the esbuild. While investigating import order for esbuild, I discovered that CSS has unintuitive import order.
Read more >
Webpack @import order (scss, css) is not kept - Stack Overflow
It seems that the ".css" files are bundled first. webpack.config.js const path = require('path'); ...
Read more >
Using with Preprocessors - Tailwind CSS
A guide to using Tailwind with common CSS preprocessors like Sass, Less, and Stylus.
Read more >
css-loader | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
How to configure CSS Modules for webpack - LogRocket Blog
Our demo app has an src folder containing index.html , style.css ... We need the css-loader module to interpret @import and url() like ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found