create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

CSS Loading Issue in development

Open Ethan-Arrowood opened this issue 8 years ago • 10 comments

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes

Which terms did you search for in User Guide?

CSS bundling for development

Environment

  1. node -v: v9.2.1
  2. npm -v: 5.5.1
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected): [email protected]

Then, specify:

  1. Operating system: macOS Sierra
  2. Browser and version (if relevant): Firefox & Chrome

Steps to Reproduce

  1. Fork https://github.com/Ethan-Arrowood/cookie-jar/tree/feature/home-page
  2. Run npm run set-up
  3. Run npm run start-server in one terminal
  4. Run npm run start-client in another terminal
  5. Open the dev tools of the browser you are in and select the <Home /> element. The <div className='container'>'s styles will not appear in the inspector; however, its children styles will.

Expected Behavior

I expect the .container css rules to be loaded onto my page like the rest of the styles defined in Home.css during development.

Actual Behavior

It appears that only the .container { } rule is being omitted, not even loaded into the bundle.

Home.css screen shot 2017-12-24 at 1 35 13 am

Inspected div.container screen shot 2017-12-24 at 1 23 01 am

Inspected div.header screen shot 2017-12-24 at 1 23 49 am

Reproducible Demo

https://cookie-jar-staging-pr-4.herokuapp.com/

This is a heroku build of this project. Does not reflect the develop environment issues I'm having as the build bundle does include the CSS and it appears in the editor. (Ignore styling behavior, I know it is broken in the deploy).

Ethan-Arrowood avatar Dec 24 '17 06:12 Ethan-Arrowood

I guess its worth summarizing:

CSS works when built and deployed. some CSS does not work during development, when served from a local server.

Whats exceptionally strange is that this some CSS is literally in the same file as other CSS being loaded into the app. There is nothing wrong with the CSS as it renders correctly when built and deployed. I've tried renaming the className to other strings like: 'box' and 'abc'. I don't have any style libraries being loaded into the project.

Ethan-Arrowood avatar Dec 24 '17 06:12 Ethan-Arrowood

Writing the CSS inline works! (But I'm trying to keep all CSS in stylesheets so this is not considered a solution) screen shot 2017-12-24 at 2 00 58 am

Ethan-Arrowood avatar Dec 24 '17 07:12 Ethan-Arrowood

On the demo you linked, I can verify that the class abc is defined and assigned to the container wrapping header, body and footer in Chrome and Firefox.

image

image

clentfort avatar Jan 02 '18 13:01 clentfort

Having same issue.. looking for update on this conversation.

mohammadwali avatar Apr 07 '18 11:04 mohammadwali

+1

I have the same issue as well. it really slows down my coding. maybe it's a webpack cache issue?

If someone has a workaround until this problem is solved, that will be great.

Thanks!

NetaLev avatar Apr 25 '18 19:04 NetaLev

Can you please see if this exists with the 2.0 beta?

$ npm install react-scripts@next

Thanks!

Timer avatar Jun 01 '18 03:06 Timer

Hmm - tried installed latest react-script - nothing.

It appears the css that is being added into the head is abruptly ending. In my case I am loading tailwind.css, and when I look at the CSS file I import './index.css', it looks fine, but the the css added to the head is not including everything - just seems to stop abruptly:

screen shot 2018-10-11 at 3 09 21 pm

TylersDesk avatar Oct 11 '18 21:10 TylersDesk

I've kept playing with this..

So I'm wondering if there is a length issue of the