Skip to content
GitLab
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 Feb 06, 2019
  • 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

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/buildbreakdo/master