Skip to content

Incorrect order of CSS in build version #7190

Open
@d07RiV

Description

@d07RiV

Is this a bug report?

Yes

Environment

npx create-react-app --info prints empty result for some reason.

Steps to Reproduce

Using CRA 3.0.1.

  1. create-react-app style_test
  2. npm i [email protected] --save
  3. In index.js import two CSS files - first, a reset CSS, second, the bootstrap CSS.
  4. Run dev server and production builds and compare results.

Expected Behavior

Both dev server and production builds should display text using bootstrap CSS.

Actual Behavior

Dev server works as expected, but production build contains two CSS chunks, one with bootstrap code and another with reset CSS, loaded in wrong order (bootstrap first). As a result, in production version text is not styled.

Bootstrap (and only bootstrap) appears in 2.*.chunk.css, while reset CSS and all my sass styles end up in main.*.chunk.css. What is the benefit of using two chunks, anyway? Just faster load times due to parallel loading of both scripts?

Reproducible Demo

https://github.com/d07RiV/style_test

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions