-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9492 from nveenjain/fix/AutomaticPrefetchPlugin
- Loading branch information
Showing
12 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/delayed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
})] |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/foo/0.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = '0'; |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/foo/a.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "This "; |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/foo/b.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "is only "; |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/foo/c.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "a test"; |
10 changes: 10 additions & 0 deletions
10
test/watchCases/plugins/automatic-prefetch-plugin-9485/0/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
it("should watch for changes", function () { | ||
if (+WATCH_STEP !== 3) expect(require("./delayed")).toBe(WATCH_STEP); | ||
else expect(require("./delayed")).toBe("This is only a test." + WATCH_STEP); | ||
if (+WATCH_STEP > 0) { | ||
for (var m of STATS_JSON.modules.filter(m => | ||
/(a|b|c)\.js$/.test(m.identifier) | ||
)) | ||
expect(m.issuer).toBe(null); | ||
} | ||
}); |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/1/foo/1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = '1'; |
1 change: 1 addition & 0 deletions
1
test/watchCases/plugins/automatic-prefetch-plugin-9485/2/foo/2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = '2'; |
5 changes: 5 additions & 0 deletions
5
test/watchCases/plugins/automatic-prefetch-plugin-9485/3/foo/3.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
var a = require("./a"); | ||
var b = require("./b"); | ||
var c = require("./c"); | ||
|
||
module.exports = a + b + c + '.3'; |
9 changes: 9 additions & 0 deletions
9
test/watchCases/plugins/automatic-prefetch-plugin-9485/delayed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function (source) { | ||
expect(source).toMatch(/^\}\)\]/); | ||
this.cacheable(false); | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
resolve("module.exports = require('./foo/' + WATCH_STEP);"); | ||
}, 500); | ||
}); | ||
}; |
15 changes: 15 additions & 0 deletions
15
test/watchCases/plugins/automatic-prefetch-plugin-9485/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const path = require("path"); | ||
const webpack = require("../../../../"); | ||
|
||
/** @type {import("../../../../").Configuration} */ | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /delayed/, | ||
use: path.resolve(__dirname, "./delayed") | ||
} | ||
] | ||
}, | ||
plugins: [new webpack.AutomaticPrefetchPlugin()] | ||
}; |