DenoDDeno
Powered by
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
node_modules
folder, mostly copied from deno cli

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

I can successfully
require
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");
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 
thread 'main' panicked at 'called 
Result::unwrap()
 on an 
 on an 
Err
 value: Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
 value: Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Gist
Code shared from the Rust Playground
Code shared from the Rust Playground. GitHub Gist: instantly share code, notes, and snippets.
Code shared from the Rust Playground
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

How to resolve this?
Hasan RimawiHHasan Rimawi / help
16mo ago