Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !6352

Add additional information for postcss errors (#6282)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/buildbreakdo/master into master 6 years ago
  • Overview 9
  • Commits 4
  • Pipelines 0
  • Changes 1

Created by: buildbreakdo

Fixes #6282 (closed): If build compiler error has postcssNode property, add additional information to the error message. Default compiler CSS error messages are opaque. To verify:

npx create-react-app css-test
cd css-test
echo "label[for=*] { margin-right: 12px; }" > ./src/App.css
yarn build

Outputs error: screen shot 2019-02-06 at 2 51 13 pm

Replace css-test/node_modules/react-scripts/build.js lines:

messages = formatWebpackMessages({
  errors: [err.message],
  warnings: [],
});

With :

        let errMessage = err.message;

        // Add additional information for postcss errors
        if (err.hasOwnProperty('postcssNode')) {
          errMessage += '\n' + path.basename(
            err['postcssNode'].source.input.file
          ) + '\nCompileError: Begins at selector ' +
            err['postcssNode'].selector +' (' +
            err['postcssNode'].source.start.line + ':' +
            err['postcssNode'].source.start.column +
            ')';
        }

        messages = formatWebpackMessages({
          errors: [errMessage],
          warnings: [],
        });

Run yarn build to view new compiler error output: screen shot 2019-02-06 at 2 52 06 pm

Approval is optional

Merged by (Jul 25, 2025 4:56am UTC)

Merge details

  • Changes merged into master with b181947f.
  • Deleted the source branch.

Activity


  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: facebook-github-bot

    Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

    If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

  • Administrator added CLA Signed label 6 years ago

    added CLA Signed label

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: facebook-github-bot

    Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: iansu

    Is the chunk name useful here? Can we point to the original source instead?

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: buildbreakdo

    @iansu Useful to know the file type, original source would have definitely been preferred. Understanding is that postcss is processing the chunk not generating the chunk itself, so this would be after the chunk was generated. err['postcssNode'].source.input.file is set to the chunk name.

      postcssNode:
       Declaration {
         raws: { before: '\n  ', between: ': ' },
         type: 'decl',
         parent:
          Rule {
            raws: [Object],
            type: 'rule',
            nodes: [Array],
            parent: [Object],
            source: [Object],
            selector: 'body',
            lastEach: 2,
            indexes: [Object] },
         source: { start: [Object], input: [Object], end: [Object] },
         prop: 'background',
         value: 'var(--site-background)' } }
  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: iansu

    I thought that might be the case. I'm just not sure how useful the chunk name is, especially in dev where the chunk isn't written to disk. I guess it can be inspected via the browser devtools?

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator requested review from @root 6 years ago

    requested review from @root

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: buildbreakdo

    @iansu Chunk name has been removed

    EDIT: Went ahead and removed the line number too, since this references a line in the chunk file that is not written to disk.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: stale[bot]

    This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

  • Administrator added stale label 6 years ago

    added stale label

  • Administrator assigned to @root 6 years ago

    assigned to @root

  • Administrator removed stale label 6 years ago

    removed stale label

  • Administrator added tag: enhancement label 6 years ago

    added tag: enhancement label

  • Administrator changed milestone to %3.2 5 years ago

    changed milestone to %3.2

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Merged by: iansu at 2019-10-23 21:26:48 UTC

  • Administrator closed 5 years ago

    closed

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: iansu

    Thanks!

Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
CLA Signed tag: enhancement
2
CLA Signed tag: enhancement
    Assign labels
  • Manage project labels

Milestone
3.3
3.3
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app!6352
Source branch: github/fork/buildbreakdo/master

Menu

Explore Projects Groups Snippets