Skip to content

Running nodejs (cjs) libs with node_modules deps using deno-runtime #23468

Answered by bartlomieju
rouzwelt asked this question in Q&A
Discussion options

You must be logged in to vote

so is this correct assumption that using cjs libs imported in main the module (loading them from node_modules) might not always work correctly as they might have require statements in them that might not work?

That's correct.

and one other question is that, besides this hack for require that you say might not always work, is there any other issues with laoding cjs modules that one needs to know about? I mean I checked the deno cli and found an algo that converts cjs to esm, is that some sort of unstable feature too when importing cjs modules with esm import statements?

That code is only required when an ESM module tries to import a CJS module. If you want to execute only CJS then it s…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rouzwelt
Comment options

@bartlomieju
Comment options

Answer selected by rouzwelt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants