三木社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 237|回复: 0
打印 上一主题 下一主题

process.mainModule

[复制链接]

1562

主题

1564

帖子

4904

积分

博士

Rank: 8Rank: 8

积分
4904
跳转到指定楼层
楼主
发表于 2017-8-14 08:31:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
require.main 的备选方法。不同点,如果主模块在运行时改变,require.main可能会继续返回老的模块。可以认为,这两者引用了同一个模块。
Alternate way to retrieverequire.main.The difference is that if the main module changes at runtime, require.mainmight still refer to the original main module in modules that were requiredbefore the change occurred. Generally it's safe to assume that the two referto the same module.
和 require.main 一样, 如果没有入口脚本,将会返回undefined 。

回复

使用道具 举报

Archiver|手机版|小黑屋|三木电子社区 ( 辽ICP备11000133号-4 )

辽公网安备 21021702000620号

GMT+8, 2025-5-3 00:04 , Processed in 0.028469 second(s), 23 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表