Skip to content

Commit aae32c7

Browse files
committed
cache buildMeta
1 parent ffb977f commit aae32c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/NormalModule.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class NormalModule extends Module {
9191
// TODO refactor this -> options object filled from Factory
9292
this.useSourceMap = false;
9393
this.lineToLine = false;
94+
95+
// Cache
96+
this._lastSuccessfulBuildMeta = {};
9497
}
9598

9699
identifier() {
@@ -228,6 +231,9 @@ class NormalModule extends Module {
228231
}
229232

230233
markModuleAsErrored(error) {
234+
// Restore build meta from successfull build to keep importing state
235+
this.buildMeta = Object.assign({}, this._lastSuccessfulBuildMeta);
236+
231237
this.error = error;
232238
this.errors.push(this.error);
233239
this._source = new RawSource("throw new Error(" + JSON.stringify(this.error.message) + ");");
@@ -323,6 +329,8 @@ class NormalModule extends Module {
323329
this.markModuleAsErrored(error);
324330
return callback();
325331
}
332+
333+
this._lastSuccessfulBuildMeta = this.buildMeta;
326334
return callback();
327335
});
328336
}

0 commit comments

Comments
 (0)