Open jmontana opened 1 year ago
Hi @jmontana, thanks for the report. The library only provides the TypeScript information, the implementation comes from Apple.
It does look like CloudKit JS can not find ArrayBuffer
in its global scope.
I am not much familiar with Angular, but is there any documentation how one can access third-party libraries, that are defined on the global window
scope? CloudKit JS itself (provided by Apple) expects to get defined in these different ways:
!function(e,t){
"object"==typeof exports&&"object"==typeof module?
module.exports=t(require("crypto"),require("fs")):
"function"==typeof define&&define.amd?
define(["crypto","fs"],t):
"object"==typeof exports?
exports.CloudKit=t(require("crypto"),require("fs")):
e.CloudKit=t(e.crypto,e.fs)
}(this,function(e,t){
// ...
You see a UMD pattern.
e
=this
(window
on client)Note that the t
in the UMD pattern is not the same as the t
in the last line of the snippet. Because of compression there are probably more t
s with different meanings. It looks like this is an issue for the Apple Forum.
You can also consider a bug report to Apple:
So the solution might be a "sloppy" mode for CloudKit JS:
<script src="https://cdn.apple-cloudkit.com/ck/2/cloudkit.js" />
and then importing tsl-apple-cloudkit
:
import * as CloudKit from 'tsl-apple-cloudkit';
The library works well up through Angular 12. When I try to use it with any version of Angular greater than 12, I get errors like this and nothing loads. If I revert to Angular 12, the app runs. Is this library compatible with Angular 13 and up?
[Error] TypeError: undefined is not an object (evaluating 't.ArrayBuffer') (anonymous function) (vendor.js:5654) (anonymous function) (vendor.js:5657) t (vendor.js:3342) (anonymous function) (vendor.js:5628) t (vendor.js:3342) (anonymous function) (vendor.js:5387) t (vendor.js:3342) (anonymous function) (vendor.js:5353) t (vendor.js:3342) (anonymous function) (vendor.js:4923) (anonymous function) (vendor.js:4976) t (vendor.js:3342) (anonymous function) (vendor.js:3467) t (vendor.js:3342) (anonymous function) (vendor.js:3356) t (vendor.js:3342) (anonymous function) (vendor.js:3332) 5741 (vendor.js:3333) __webpack_require__ (runtime.js:23) 1367 (main.js:200:96) __webpack_require__ (runtime.js:23) 5041 (main.js:16:96) __webpack_require__ (runtime.js:23) 6747 (main.js:171:92) __webpack_require__ (runtime.js:23) 4431 (main.js:521:93) __webpack_require__ (runtime.js:23) (anonymous function) (runtime.js:57) (anonymous function) (main.js:560) webpackJsonpCallback (runtime.js:145) webpackJsonpCallback Module Code (main.js:1)