Skip to content

Commit 1c7a8a2

Browse files
authored
fix: this.addBuildDependency usage (#117)
1 parent 0dbea4d commit 1c7a8a2

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function pitch() {
3636
},
3737
(err, r) => {
3838
if (r) {
39+
r.buildDependencies.forEach((d) => this.addBuildDependency(d));
3940
r.fileDependencies.forEach((d) => this.addDependency(d));
4041
r.contextDependencies.forEach((d) => this.addContextDependency(d));
4142
}

src/worker.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
119119
});
120120
nextQuestionId += 1;
121121
};
122+
const buildDependencies = [];
122123
loaderRunner.runLoaders(
123124
{
124125
loaders: data.loaders,
@@ -230,6 +231,9 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
230231
module._compile(code, filename); // eslint-disable-line no-underscore-dangle
231232
return module.exports;
232233
},
234+
addBuildDependency: (filename) => {
235+
buildDependencies.push(filename);
236+
},
233237
options: {
234238
context: data.optionsContext,
235239
},
@@ -279,6 +283,7 @@ const queue = asyncQueue(({ id, data }, taskCallback) => {
279283
result: {
280284
result: convertedResult,
281285
cacheable,
286+
buildDependencies,
282287
fileDependencies,
283288
contextDependencies,
284289
},

test/pitch.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const runGetPoolMock = (error) => {
1515
isAbleToRun: () => true,
1616
run: jest.fn((opts, cb) => {
1717
cb(error, {
18+
buildDependencies: [],
1819
fileDependencies: [],
1920
contextDependencies: [],
2021
result: {},

0 commit comments

Comments
 (0)