chyyranC
Denoβ€’3y agoβ€’
2 replies
chyyran

How to resolve requires without `.js` extension in a very basic NPM resolver?

I have an NPM resolver that without caching that expects everything to be in a node_modules folder, mostly copied from deno cli

https://gist.github.com/rust-play/fbd49c87332ee27b3d217bb1e0005462

I can successfully require lodash, but one of the npm libraries I'm trying to require imports a babel library like so

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");


It seems like it's failing to resolve the module, cause it panics at thread 'main' panicked at 'called Result::unwrap() on an Err value: Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Gist
Code shared from the Rust Playground. GitHub Gist: instantly share code, notes, and snippets.
Code shared from the Rust Playground
Was this page helpful?