Open
Description
The relevent code in node is in resolve.js where there is a realPathSync call
This realPathSycn call does not get the fs monkey paches while the cjs require loader's realPathSync call does. It is unclear why.
This is the underlying reason why we current need --preserve-symlinks-main
on by default in js_library so the .mjs
entry points don't escape their runfiles.
It is also the reason mocha was observed to escape the sandbox in the repro #353 (comment) and likely related to #347.
This affects .mjs
entry points and programs that use esm imports. For example, mocha uses the import()
built-in that is affected.