File tree 1 file changed +12
-3
lines changed
packages/gatsby/src/bootstrap/load-plugins 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
ISiteConfig ,
18
18
} from "./types"
19
19
import { PackageJson } from "../../.."
20
+ import reporter from "gatsby-cli/lib/reporter"
20
21
21
22
function createFileContentHash ( root : string , globPattern : string ) : string {
22
23
const hash = crypto . createHash ( `md5` )
@@ -118,9 +119,17 @@ export function resolvePlugin(
118
119
version : packageJSON . version ,
119
120
}
120
121
} catch ( err ) {
121
- throw new Error (
122
- `Unable to find plugin "${ pluginName } ". Perhaps you need to install its package?`
123
- )
122
+ if ( process . env . gatsby_log_level === `verbose` ) {
123
+ reporter . panicOnBuild (
124
+ `plugin "${ pluginName } threw the following error:\n` ,
125
+ err
126
+ )
127
+ } else {
128
+ reporter . panicOnBuild (
129
+ `There was a problem loading plugin "${ pluginName } ". Perhaps you need to install its package?\nUse --verbose to see actual error.`
130
+ )
131
+ }
132
+ throw new Error ( `unreachable` )
124
133
}
125
134
}
126
135
You can’t perform that action at this time.
0 commit comments