webpack/test/configCases/library/render-order-issue/loader.js

22 lines
546 B
JavaScript

"use strict";
/** @typedef {import("../../../../types").LoaderDefinition} LoaderDefinition */
/**
* @type {LoaderDefinition}
*/
module.exports = function loader(code) {
const request = this.resourcePath;
const callback = this.async();
// You can simulate an unstable async operation by switching the waiting module
// uncomment this 👇 and run again
// if (request.includes("entry1")) {
if (request.includes("entry2")) {
setTimeout(() => {
callback(null, code);
}, 2000);
} else {
callback(null, code);
}
};