deno icon indicating copy to clipboard operation
deno copied to clipboard

feat(compat): Allow --compat to be used with bundle command

Open arendjr opened this issue 2 years ago • 1 comments

This is the second part of https://github.com/denoland/deno/issues/14846.

The test won't succeed yet, because while this PR allows for passing --compat now, the generated bundle contains Deno's std/node library, which I think should be omitted for this use case, so that the bundle will become runnable on a real Node runtime. This means leaving the imports to Node's built-ins unaltered in the generated bundle, but I haven't found out exactly how to accomplish this. A pointer by one of the Deno maintainers on how to achieve this would be appreciated. Thanks!

arendjr avatar Jun 11 '22 15:06 arendjr

Also I’d be curious to hear if we should introduce another CLI flag (--omit-node-std, maybe?) so that users can choose whether the std/node lib is included or not. If it’s included, the resulting bundle should work in Deno (without needing to pass the --compat flag anymore). Without it, it should work in Node.

arendjr avatar Jun 11 '22 15:06 arendjr

@arendjr thank you for this PR, but I'm going to close it without a merge. We're removing --compat mode in https://github.com/denoland/deno/pull/15678 and using npm: specifiers is the way forward for npm compatibility. Thanks for the work and sorry we can't merge it.

bartlomieju avatar Sep 03 '22 13:09 bartlomieju