mirror of https://github.com/webpack/webpack.git
test: add a case for readRecords hook usage
This commit is contained in:
parent
83d049a1bd
commit
d011d86226
|
|
@ -0,0 +1,12 @@
|
||||||
|
class ReadRecordsPlugin {
|
||||||
|
apply(compiler) {
|
||||||
|
compiler.hooks.readRecords.tapAsync("ReadRecordsPlugin", callback => {
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log("Done with reading records.");
|
||||||
|
callback();
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ReadRecordsPlugin;
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
import "vendor";
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
it("should load fine", () => {
|
||||||
|
return import(/* webpackChunkName: "async" */"./async");
|
||||||
|
});
|
||||||
0
test/configCases/records/with-readRecords-hook/node_modules/vendor.js
generated
vendored
Normal file
0
test/configCases/records/with-readRecords-hook/node_modules/vendor.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"chunks": {
|
||||||
|
"byName": {
|
||||||
|
"vendors~async": 123
|
||||||
|
},
|
||||||
|
"bySource": {
|
||||||
|
"1 index.js ./async": 123
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
const path = require("path");
|
||||||
|
const ReadRecordsPlugin = require("./ReadRecordsPlugin");
|
||||||
|
|
||||||
|
/** @type {import("../../../../").Configuration} */
|
||||||
|
module.exports = {
|
||||||
|
entry: "./index",
|
||||||
|
recordsInputPath: path.resolve(__dirname, "records.json"),
|
||||||
|
output: {
|
||||||
|
chunkFilename: "[name]-[chunkhash].js"
|
||||||
|
},
|
||||||
|
plugins: [new ReadRecordsPlugin()],
|
||||||
|
optimization: {
|
||||||
|
splitChunks: {
|
||||||
|
minSize: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue