Skip to content

Failed to compile message without any detail. #5008

@RIP21

Description

@RIP21

This is issue created for discussing fix of the weird common Alphas 2.0.0 error that looks like that:
https://user-images.githubusercontent.com/616428/41606667-3591d1de-73b2-11e8-8b19-3b571b63a592.png

I did some research trying to find the root cause and it seems that I found it.

Seems to be an issue in formatWebpackMessages.js

// Remove unnecessary stack added by `thread-loader`
  var threadLoaderIndex = -1;
  lines.forEach(function(line, index) {
    if (threadLoaderIndex !== -1) {
      return;
    }
    if (/thread.loader/i.test(line)) {
      threadLoaderIndex = index;
    }
  });

  if (threadLoaderIndex !== -1) {
    lines = lines.slice(0, threadLoaderIndex);
  }

This piece is deletes everything after 'thread-loader'. So when you have an error or warning it will be striped out to the path only.
So message like that:

./src/elements/FormSignIn/index.js
Module Warning (from ./node_modules/thread-loader/dist/cjs.js): <<<< Takes this line index

�[4m/Users/andriilos/Projects/<annon>/<annon>/src/elements/FormSignIn/index.js�[24m
  �[2m6:13�[22m  �[33mwarning�[39m  'UI' is defined but never used              �[2mno-unused-vars�[22m
  �[2m9:7�[22m   �[33mwarning�[39m  'sleep' is assigned a value but never used  �[2mno-unused-vars�[22m

�[33m�[1m✖ 2 problems (0 errors, 2 warnings)�[22m�[39m
�[33m�[1m�[22m�[39m
 @ ./src/pages/SignIn/index.js 1:2249-2293 1:3910-3920
 @ ./src/App.js
 @ ./src/index.js
 @ multi ./node_modules/revolut-react-scripts/config/polyfills.js ./src/index.js <<< removes all till that line

End up like:

./src/elements/FormSignIn/index.js

So effectively changing

  if (threadLoaderIndex !== -1) {
    lines = lines.slice(0, threadLoaderIndex);
  }

to

  if (threadLoaderIndex !== -1) {
    lines.splice(threadLoaderIndex, 1);
  }

May fix this, I'm not sure about other errors and warnings formats so a little discussion will be a nice thing to do before I open a PR if you like.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions