File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/vite/src/node/server/middlewares Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,19 @@ import { ViteDevServer } from '../..'
4
4
import { Connect } from 'types/connect'
5
5
import { pad } from '../../utils'
6
6
import strip from 'strip-ansi'
7
+ import { ErrorPayload } from 'types/hmrPayload'
7
8
8
- export function prepareError ( err : Error | RollupError ) {
9
+ export function prepareError ( err : Error | RollupError ) : ErrorPayload [ 'err' ] {
10
+ // only copy the information we need and avoid serializing unnecessary
11
+ // properties, since some errors may attach full objects (e.g. PostCSS)
9
12
return {
10
- ...err ,
11
13
message : strip ( err . message ) ,
12
14
stack : strip ( err . stack || '' ) ,
13
- frame : strip ( ( err as RollupError ) . frame || '' )
15
+ id : ( err as RollupError ) . id ,
16
+ frame : strip ( ( err as RollupError ) . frame || '' ) ,
17
+ plugin : ( err as RollupError ) . plugin ,
18
+ pluginCode : ( err as RollupError ) . pluginCode ,
19
+ loc : ( err as RollupError ) . loc
14
20
}
15
21
}
16
22
You can’t perform that action at this time.
0 commit comments