Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Conversation

@chrisbreiding
Copy link
Collaborator

@chrisbreiding chrisbreiding commented Aug 7, 2020

Webpack's errors can be overly verbose. This reduces them to only useful information.

Module Not Found Before:

Error: Webpack Compilation Error ./cypress/integration/record_error_spec.coffee Module not found: Error: Can't resolve '../it/does/not/exist' in '/foo/bar/.projects/e2e/cypress/integration' resolve '../it/does/not/exist' in '/foo/bar/.projects/e2e/cypress/integration' using description file: /foo/bar/.projects/e2e/package.json (relative path: ./cypress/integration) Field 'browser' doesn't contain a valid alias configuration using description file: /foo/bar/.projects/e2e/package.json (relative path: ./cypress/it/does/not/exist) no extension Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.json doesn't exist .jsx Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.jsx doesn't exist .coffee Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.coffee doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.ts doesn't exist .tsx Field 'browser' doesn't contain a valid alias configuration /foo/bar/.projects/e2e/cypress/it/does/not/exist.tsx doesn't exist as directory /foo/bar/.projects/e2e/cypress/it/does/not/exist doesn't exist [/foo/bar/.projects/e2e/cypress/it/does/not/exist] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.js] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.json] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.jsx] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.coffee] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.ts] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.tsx] @ ./cypress/integration/record_error_spec.coffee 1:0-31 @ multi ./cypress/integration/record_error_spec.coffee 

Module Not Found After:

Error: Webpack Compilation Error ./cypress/integration/record_error_spec.coffee Module not found: Error: Can't resolve '../it/does/not/exist' in '/foo/bar/.projects/e2e/cypress/integration' Looked for and couldn't find the file at the following paths: [/foo/bar/.projects/e2e/cypress/it/does/not/exist] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.js] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.json] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.jsx] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.coffee] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.ts] [/foo/bar/.projects/e2e/cypress/it/does/not/exist.tsx] @ ./cypress/integration/record_error_spec.coffee 1:0-31 @ multi ./cypress/integration/record_error_spec.coffee 

Syntax Error Before:*

Error: Webpack Compilation Error describe('fail', - > );	./cypress/integration/typescript_failing_spec.tsXX:XX ^	Module parse failed: Unexpected token (4:19) ParseError: Unexpected token	File was processed with these loaders: * ../../../../node_modules/@cypress/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js You may need an additional loader to handle the result of these loaders. | // The code below is ignored by eslint | // because it tests failing spec. > describe('fail', - > ); | @ multi ./cypress/integration/typescript_failing_spec.ts main[0] /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts ./cypress/integration/typescript_failing_spec.ts [tsl] ERROR in /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts(3,19) TS1109: Expression expected. @ multi ./cypress/integration/typescript_failing_spec.ts main[0] /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts ./cypress/integration/typescript_failing_spec.ts [tsl] ERROR in /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts(3,21) TS1109: Expression expected. @ multi ./cypress/integration/typescript_failing_spec.ts main[0] 

Syntax Error After:*

Error: Webpack Compilation Error describe('fail', - > );	./cypress/integration/typescript_failing_spec.tsXX:XX ^	Module parse failed: Unexpected token (4:19) ParseError: Unexpected token	File was processed with these loaders: * ../../../../node_modules/@cypress/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js You may need an additional loader to handle the result of these loaders. | // The code below is ignored by eslint | // because it tests failing spec. > describe('fail', - > ); | 
Copy link
Contributor

@kuceb kuceb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome. I believe this occurs not only for Module not found errors, for example this syntax error (from webpack default PR snapshots)

Error: Webpack Compilation Error describe('fail', - > );	./cypress/integration/typescript_failing_spec.tsXX:XX ^	Module parse failed: Unexpected token (4:19) ParseError: Unexpected token	File was processed with these loaders: * ../../../../node_modules/@cypress/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js You may need an additional loader to handle the result of these loaders. | // The code below is ignored by eslint | // because it tests failing spec. > describe('fail', - > ); | @ multi ./cypress/integration/typescript_failing_spec.ts main[0] /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts ./cypress/integration/typescript_failing_spec.ts [tsl] ERROR in /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts(3,19) TS1109: Expression expected. @ multi ./cypress/integration/typescript_failing_spec.ts main[0] /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts ./cypress/integration/typescript_failing_spec.ts [tsl] ERROR in /foo/bar/.projects/e2e/cypress/integration/typescript_failing_spec.ts(3,21) TS1109: Expression expected. @ multi ./cypress/integration/typescript_failing_spec.ts main[0] 
@chrisbreiding
Copy link
Collaborator Author

@bkucera I now have it removing everything after '@ multi' in error messages, as that seems to all be extra nonsense.

@chrisbreiding chrisbreiding requested a review from kuceb August 7, 2020 19:19
@chrisbreiding chrisbreiding changed the title Quiet module not found error message Quiet error messages Aug 10, 2020
@chrisbreiding chrisbreiding changed the title Quiet error messages fix: Reduce the verbosity of error messages Aug 10, 2020
@chrisbreiding chrisbreiding merged commit ba0dc3d into master Aug 10, 2020
@chrisbreiding
Copy link
Collaborator Author

🎉 This PR is included in version 5.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3 participants