webpack/test/cases/errors/import-module-cycle/loader.js

13 lines
379 B
JavaScript
Raw Normal View History

2025-05-01 22:36:51 +08:00
/** @type {import("../../../../").LoaderDefinition} */
2024-01-23 17:32:02 +08:00
exports.default = function (source) {
const ref = JSON.parse(source);
const callback = this.async();
this.importModule("../loader!" + ref, {}, (err, exports) => {
if (err) {
callback(null, JSON.stringify(`err: ${err && err.message}`));
} else {
callback(null, JSON.stringify(`source: ${exports}`));
}
});
};