--preserve-symlinks-main


指示模块加载器在解析和缓存主模块 (require.main) 时保留符号链接。

此标志的存在是为了让主模块可以选择加入 --preserve-symlinks 为所有其他导入提供的相同行为;但是,它们是单独的标志,以便与旧的 Node.js 版本向后兼容。

--preserve-symlinks-main 并不意味着 --preserve-symlinks;当在解析相对路径之前不希望遵循符号链接时,除了 --preserve-symlinks 之外,还使用 ​​--preserve-symlinks-main

有关详细信息,请参阅 --preserve-symlinks

Instructs the module loader to preserve symbolic links when resolving and caching the main module (require.main).

This flag exists so that the main module can be opted-in to the same behavior that --preserve-symlinks gives to all other imports; they are separate flags, however, for backward compatibility with older Node.js versions.

--preserve-symlinks-main does not imply --preserve-symlinks; use --preserve-symlinks-main in addition to --preserve-symlinks when it is not desirable to follow symlinks before resolving relative paths.

See --preserve-symlinks for more information.