--experimental-package-map=


稳定性: 1 - 实验性

启用实验性的包映射解析。path 参数指定了一个 JSON 配置文件的位置,该文件定义了包解析映射。

🌐 Enable experimental package map resolution. The path argument specifies the location of a JSON configuration file that defines package resolution mappings.

node --experimental-package-map=./package-map.json app.js 

启用后,裸指定符解析会参考包映射来进行解析。这样可以明确控制哪些包可以导入哪些依赖。

🌐 When enabled, bare specifier resolution consults the package map for resolution. This allows explicit control over which packages can import which dependencies.

有关配置文件格式和解析算法的详细信息,请参见 封装地图

🌐 See Package maps for details on the configuration file format and resolution algorithm.