【发布时间】:2016-06-30 09:17:27
【问题描述】:
我在 MomentJS 中使用 fullCalendar 插件,在 babel 编译后,我遇到了有关 MomentJS 的错误:
global is undefined
你知道问题出在哪里吗?
谢谢!
【问题讨论】:
标签: javascript fullcalendar momentjs babeljs
我在 MomentJS 中使用 fullCalendar 插件,在 babel 编译后,我遇到了有关 MomentJS 的错误:
global is undefined
你知道问题出在哪里吗?
谢谢!
【问题讨论】:
标签: javascript fullcalendar momentjs babeljs
我相信我已经找到了解决这个问题的方法。我在与 Moment 不同的库上遇到错误。 Heroku 日志报告了
找不到模块:错误:无法解析 /app/node_modules/sentiment/lib 中的模块“json-loader”
但是,在 babel 编译之后(通过 webpack)我在控制台中遇到了同样的错误
Uncaught ReferenceError: global is not defined
当我美化压缩代码时,在这一行抛出了错误
x=global.Object.prototype
我追踪到图书馆 lodash。 Webpack 使用 lodash 来运行 babel。根据this conversation thread 中的信息,该问题已通过将 lodash 版本从 3.5.0 更新到 4.13.1 得到解决。
控制台错误和未找到模块错误都消失了。
【讨论】: