Skip to content

react-scripts@next drops css import in production build #5140

Closed
@cdaringe

Description

@cdaringe

Is this a bug report?

yes

Did you try recovering your dependencies?

yes.

$ yarn --version
1.9.0-20180706.1003

Which terms did you search for in User Guide?

n/a

Environment

Environment:
  OS:  macOS High Sierra 10.13.6
  Node:  10.10.0
  Yarn:  1.9.0-20180706.1003
  npm:  6.4.1
  Watchman:  Not Found
  Xcode:  Xcode 9.4.1 Build version 9F2000
  Android Studio:  Not Found

Packages: (wanted => installed)
  react: ^16.5.2 => 16.5.2
  react-dom: ^16.5.2 => 16.5.2
  react-scripts: next => 2.0.0

Steps to Reproduce

(Write your steps here:)

  1. clone https://github.com/cdaringe/will-u-load-my-styl/
  2. observe that there are exactly two commits. one is a fresh commit of npx create-react-app@next, the other adds a component lib & style sheet
  3. yarn start. observe a styles applied. kill the process
  4. yarn build. serve the production build. observe missing styles.

originally discovered here

Expected Behavior

  • imported stylesheet should be included in bundle

Actual Behavior

  • imported stylesheet is missing

more specfically, here, a css file is imported as shown below:

import 'react-octagon/lib/styles/semantic.css'
...

this dependency shows up in dev mode in the dev server, but no such CSS is generated into the build dir.

interestingly, importing the desired css file from within another CSS file produces expected results. see @youngbob's remark here.

Reproducible Demo

instructions listed above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions