isomorphic-git clone() TypeError: Cannot read property 'bind' of undefined
isomorphic-git clone() TypeError: Cannot read property 'bind' of undefined
我想在 Kintone 上使用 BrowserFS 的同构-git(不支持模块导入)。
我不控制脚本标签,但这就是它们包含在结果页面中的方式:
<script src="https://unpkg.com/isomorphic-git@1.7.4"></script>
<script src="https://unpkg.com/browserfs"></script>
然后,我初始化 BrowserFS 以使用浏览器的 IndexedDB 作为其文件系统:
(new Promise((resolve,reject)=> {
BrowserFS.getFileSystem({
fs: "IndexedDB",
options: {}
}, function(error,fs) {
if (error) {
BrowserFS.configure({
fs: "IndexedDB",
options: {}
}, function(error) {
if (error) {
reject(error)
}
const fs = BrowserFS.BFSRequire("fs")
BrowserFS.BFSRequire("path")
resolve(fs)
})
}
resolve(BrowserFS.initialize(fs))
})
})).then(fs => {
...
最后,我对同构-git模块使用动态导入:
return import('https://unpkg.com/isomorphic-git@1.7.4/http/web/index.js').then(http => {
window.http = http
return true
})
}).then(response => {
...
当我尝试运行一个git克隆命令时...
return git.clone({
fs,
http,
dir:stagingRoot,
corsProxy: 'https://cors.isomorphic-git.org',
url: repositoryURL.getValue(),
ref: branch.getValue(),
onAuth: url => {
const auth = {
username: username.getValue(),
password: password.getValue(),
}
return auth
},
singleBranch: true,
depth: 100
})
}).then(response => {
...
我收到以下类型错误:
Uncaught (in promise) TypeError: Cannot read property 'bind' of undefined
at new u (isomorphic-git@1.7.4:formatted:157)
at Module.<anonymous> (isomorphic-git@1.7.4:formatted:13793)
at Generator.next (<anonymous>)
at Qt (isomorphic-git@1.7.4:formatted:13757)
at a (isomorphic-git@1.7.4:formatted:13771)
at isomorphic-git@1.7.4:formatted:13776
at new Promise (<anonymous>)
at Module.<anonymous> (isomorphic-git@1.7.4:formatted:13768)
at Module.re (isomorphic-git@1.7.4:formatted:13821)
at Module.ee (isomorphic-git@1.7.4:formatted:13782)
知道它来自哪里吗?
这是一个简单的脚本标签导入排序问题。正确的顺序是:
<script src="https://unpkg.com/browserfs"></script>
<script src="https://unpkg.com/isomorphic-git@1.7.4"></script>
我在使用 BrowserFS 时遇到了其他问题,所以我最终恢复到 isomorphic-git 提供 lightning-fs ...
我想在 Kintone 上使用 BrowserFS 的同构-git(不支持模块导入)。
我不控制脚本标签,但这就是它们包含在结果页面中的方式:
<script src="https://unpkg.com/isomorphic-git@1.7.4"></script>
<script src="https://unpkg.com/browserfs"></script>
然后,我初始化 BrowserFS 以使用浏览器的 IndexedDB 作为其文件系统:
(new Promise((resolve,reject)=> {
BrowserFS.getFileSystem({
fs: "IndexedDB",
options: {}
}, function(error,fs) {
if (error) {
BrowserFS.configure({
fs: "IndexedDB",
options: {}
}, function(error) {
if (error) {
reject(error)
}
const fs = BrowserFS.BFSRequire("fs")
BrowserFS.BFSRequire("path")
resolve(fs)
})
}
resolve(BrowserFS.initialize(fs))
})
})).then(fs => {
...
最后,我对同构-git模块使用动态导入:
return import('https://unpkg.com/isomorphic-git@1.7.4/http/web/index.js').then(http => {
window.http = http
return true
})
}).then(response => {
...
当我尝试运行一个git克隆命令时...
return git.clone({
fs,
http,
dir:stagingRoot,
corsProxy: 'https://cors.isomorphic-git.org',
url: repositoryURL.getValue(),
ref: branch.getValue(),
onAuth: url => {
const auth = {
username: username.getValue(),
password: password.getValue(),
}
return auth
},
singleBranch: true,
depth: 100
})
}).then(response => {
...
我收到以下类型错误:
Uncaught (in promise) TypeError: Cannot read property 'bind' of undefined
at new u (isomorphic-git@1.7.4:formatted:157)
at Module.<anonymous> (isomorphic-git@1.7.4:formatted:13793)
at Generator.next (<anonymous>)
at Qt (isomorphic-git@1.7.4:formatted:13757)
at a (isomorphic-git@1.7.4:formatted:13771)
at isomorphic-git@1.7.4:formatted:13776
at new Promise (<anonymous>)
at Module.<anonymous> (isomorphic-git@1.7.4:formatted:13768)
at Module.re (isomorphic-git@1.7.4:formatted:13821)
at Module.ee (isomorphic-git@1.7.4:formatted:13782)
知道它来自哪里吗?
这是一个简单的脚本标签导入排序问题。正确的顺序是:
<script src="https://unpkg.com/browserfs"></script>
<script src="https://unpkg.com/isomorphic-git@1.7.4"></script>
我在使用 BrowserFS 时遇到了其他问题,所以我最终恢复到 isomorphic-git 提供 lightning-fs ...