ApoorvSaxena / ApoorvSaxena/lozad.js

Gulp.js issue: Cannot set property 'lozad' of undefined

未关闭
#261 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
7.5k
派生
435
PR 合并指标
30 天内没有已合并 PR

描述

Hi, thanks for the cool library!
Recently faced an unobvious problem

## Current Behavior
When adding a library using gulp.js (concatenate many scripts into one file), I get the error `Cannot set property 'lozad' of undefined`, the error was in this line of code `(global.lozad = factory());` global was undefined
although when loading via cdn - there are no errors

## Possible Solution
I added a simple check `(global = global || self, global.lozad = factory());` and everything worked as expected

Please pay attention

P.S. You've got a cool tool

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。