tencentyun / cos-js-sdk-v5

腾讯云 COS JS SDK(XML API)
https://cloud.tencent.com/product/cos
MIT License
330 stars 566 forks source link

global is not define #30

Closed q986171791 closed 5 years ago

q986171791 commented 6 years ago

///////////////////Here is my test code start/////////////////// const cos = require('cos-js-sdk-v5') console.log(cos); ///////////////////Here is my test code end///////////////////

but I got a error

in utils .js

isBrowser:!!global.document // This is error code

when i download dist/**.min.js file

run it again

it is good

q986171791 commented 6 years ago

by the way, framework:angular 6.xx system:mac

carsonxu commented 6 years ago

thank you for commit issue, I will check it as soon as possiable.

s97712 commented 5 years ago

+1, this problom still not fix?

s97712 commented 5 years ago

This problom may in ../node_modules/cos-js-sdk-v5/src/util.js, it use global variable

s97712 commented 5 years ago

有人解决没,没有我去隔壁阿里云逛逛了

s97712 commented 5 years ago

@carsonxu

carsonxu commented 5 years ago

怎么使用产生的报错?

s97712 commented 5 years ago

环境是angular7 通过npm使用的

s97712 commented 5 years ago

我在构建后的文件 ../node_modules/cos-js-sdk-v5/src/util.js 发现了几个global变量,是不是构建出问题了。

s97712 commented 5 years ago

package.json 的main是不是应该指向dist

carsonxu commented 5 years ago

考虑如果用 dist 用户使用 webpack 打包的时候,会多出一份 webpack 代码 ,这里是指向 src。 我下午调试确认看看。

s97712 commented 5 years ago

你们的构建感觉不太完善啊,其它库都有提供多个环境的构建的

carsonxu commented 5 years ago

已修复 global 报错,感谢反馈。多环境构建后续补充。