Skip to content

Commit fcf5975

Browse files
committed
fix: jsr resolver needs to return something for node in current impl
1 parent 089805b commit fcf5975

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/webpack/resolve.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ export class DenoLoaderPlugin {
399399
"node resolveForScheme",
400400
resolveData.request,
401401
);
402-
span.resolved("stubbed: not found");
403-
return;
402+
resourceData.path = false as any;
403+
resourceData.data.path = false;
404+
span.resolved("stubbed: empty module");
405+
return true;
404406
},
405407
);
406408
normalModuleFactory.hooks.resolveForScheme.for("jsr").tapPromise(
@@ -491,6 +493,12 @@ export class DenoLoaderPlugin {
491493
);
492494
const hooks = Webpack.NormalModule.getCompilationHooks(compilation);
493495

496+
hooks.readResourceForScheme.for("node").tapAsync(
497+
"JsrPlugin",
498+
async (_resource, _module, cb) => {
499+
cb(null, Buffer.from("module.exports = {};"));
500+
},
501+
);
494502
hooks.readResourceForScheme.for("jsr").tapPromise(
495503
"JsrPlugin",
496504
async (resource, module) => {

0 commit comments

Comments
 (0)