Skip to content

Commit b3aea99

Browse files
committed
fix: display hidden compiler failed errors
1 parent b769af6 commit b3aea99

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

Diff for: packages/driver-webpack/lib/webpack/friendly-error.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
const FriendlyErrorsWebpackPlugin = require( 'friendly-errors-webpack-plugin' )
1+
const FriendlyErrorsPlugin = require( './plugins/FriendlyErrorPlugin' )
22

33
exports.extend = function ( config ) {
44
config
55
.plugin( 'friendly-error' )
6-
.use( FriendlyErrorsWebpackPlugin, [
7-
{
8-
clearConsole: false,
9-
additionalTransformers: [
10-
require( './error/transformer-module-not-found' ),
11-
]
12-
}
13-
] )
6+
.use( FriendlyErrorsPlugin )
147
}
158

169
exports.extendDevServer = function ( serverOptions = {} ) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const FriendlyErrorsWebpackPlugin = require( 'friendly-errors-webpack-plugin' )
2+
const output = require( 'friendly-errors-webpack-plugin/src/output' )
3+
4+
const ID = `FriendlyErrorsPlugin`
5+
6+
class FriendlyErrorsPlugin {
7+
apply( compiler ) {
8+
const friendlyError = new FriendlyErrorsWebpackPlugin( {
9+
clearConsole: false,
10+
additionalTransformers: [
11+
require( '../error/transformer-module-not-found' ),
12+
]
13+
} )
14+
15+
friendlyError.apply( compiler )
16+
17+
compiler.hooks.failed.tap( ID, error => {
18+
friendlyError.clearConsole()
19+
output.title( 'error', 'ERROR', `Failed to compile with 1 errors` )
20+
console.log( error.stack || error.message )
21+
} )
22+
}
23+
}
24+
25+
module.exports = FriendlyErrorsPlugin

Diff for: packages/driver-webpack/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"exit": "^0.1.2",
5151
"fast-memoize": "^2.5.1",
5252
"file-loader": "^4.3.0",
53-
"friendly-errors-webpack-plugin": "^1.7.0",
53+
"friendly-errors-webpack-plugin": "1.7.0",
5454
"hash-sum": "^2.0.0",
5555
"html-webpack-plugin": "^4.0.0-beta.4",
5656
"less": "^3.10.3",

Diff for: yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -6797,7 +6797,7 @@ [email protected]:
67976797
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
67986798
integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=
67996799

6800-
friendly-errors-webpack-plugin@^1.7.0:
6800+
friendly-errors-webpack-plugin@1.7.0, friendly-errors-webpack-plugin@^1.7.0:
68016801
version "1.7.0"
68026802
resolved "https://registry.yarnpkg.com/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.7.0.tgz#efc86cbb816224565861a1be7a9d84d0aafea136"
68036803
integrity sha512-K27M3VK30wVoOarP651zDmb93R9zF28usW4ocaK3mfQeIEI5BPht/EzZs5E8QLLwbLRJQMwscAjDxYPb1FuNiw==

0 commit comments

Comments
 (0)