Open jeremyBanks opened 2 weeks ago
I've tried to reduce this by using --node-modules-dir
and editing it down locally. If I'm understanding correctly, these imports seem to resolve incorrectly when they're on the right-side of an export assignment.
// error: could not find package 'buffer'
module.exports = require("buffer");
// error: could not find package 'buffer'
exports = require("buffer");
// error: could not find package 'buffer'
function f() {
exports = require("buffer");
}
//error: could not find package 'node:buffer'
module.exports = require("node:buffer");
If we make the export indirect, the imports are successful and we're able to use the re-exported value successfully.
// successful
const buffer = require("buffer");
module.exports = buffer;
// successful
const nodeBuffer = require("node:buffer");
module.exports = nodeBuffer;
Attempting to import
npm:contentful-management
produces the following error (the same as denoland/deno_ast#227, but per https://github.com/denoland/deno_ast/issues/227#issuecomment-2179031517 it's a different underlying issue):It seems like it might be interpreting a locally-ambiguous import of
zlib
that should be resolved as the built-in node module (node:zlib
) instead as if it's an import for an NPM module of the same name (npm:zlib
), but from a quick look I wasn't able to identify where the problematic import is actually happening.