Skip to content

Real life purpose of emitting errors about BEM module #74

@qfox

Description

@qfox

For now we have code for emitting errors about non existent BEM modules.

webpack-bem-loader/index.js

Lines 139 to 144 in e9c1640

Object.keys(existsEntities).forEach(fileId => {
// check if entity has no tech to resolve
existsEntities[fileId] || errEntities[fileId].forEach(file => {
this.emitError(`BEM module not found: ${file.path}`);
});
});

In real projects it looks like infinite noise that does not help.
At the same time emitError requires a special as an argument as passing there a string generates Critical errors inside Webpack itself.

ERROR in ./blocks/block-a/block-a.react.js
(Emitted value instead of an instance of Error) BEM module not found: ../block-b/block-b.css
 @ ./blocks/block-a/block-a.examples/index.react.js 21:26-59 21:71-104

Actually, there are 2 cases that we should fix here:

  • Create an error object instead of string to pass it in emitError
  • Reduce count of errors (to a zero if possible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions