webpack/test/cases/errors/load-module-error/loader.js

13 lines
384 B
JavaScript
Raw Normal View History

2025-05-01 22:36:51 +08:00
/** @type {import("../../../../").LoaderDefinition} */
exports.default = function (source) {
const callback = this.async();
const ref = JSON.parse(source);
this.loadModule("./error-loader!" + ref, (err, source, sourceMap, module) => {
if (err) {
callback(err);
} else {
2025-05-01 22:36:51 +08:00
callback(null, JSON.stringify(`source: ${JSON.parse(/** @type {string} */ (source))}`));
}
});
};