cmliu / CF-Workers-docker.io

这个项目是一个基于 Cloudflare Workers 的 Docker 镜像代理工具。它能够中转对 Docker 官方镜像仓库的请求,解决一些访问限制和加速访问的问题。
https://docker.fxxk.dedyn.io
4.9k stars 5.72k forks source link

Uncaught SyntaxError: Unexpected token 'export' at worker.js:217:4 (Code: 10021) #2

Closed a39353678 closed 3 months ago

a39353678 commented 3 months ago

Uncaught SyntaxError: Unexpected token 'export' at worker.js:217:4 (Code: 10021)

rexshao commented 3 months ago

修改

export default {
    async fetch(request, env, ctx) {

addEventListener('fetch', e => {
    const ret = fetchHandler(e.request,{})
        .catch(err => makeRes('cfworker error:\n' + err.stack, 502))
    e.respondWith(ret)
})
async function fetchHandler(request, env, ctx) {

去掉 export default { 对应的 中括号即可

rexshao commented 3 months ago

或者删掉worker重新创建也可以 好像之前创建的worker不支持 export 最近新创建的支持了

cmliu commented 3 months ago

Uncaught SyntaxError: Unexpected token 'export' at worker.js:217:4 (Code: 10021)

关闭窗口重新编辑保存

a39353678 commented 3 months ago

Uncaught SyntaxError: Unexpected token 'export' at worker.js:217:4 (Code: 10021)

关闭窗口重新编辑保存

重新新建了workers 没有报错

a39353678 commented 3 months ago

或者删掉worker重新创建也可以

好像之前创建的worker不支持 export 最近新创建的支持了

嗯,新建了workers 不抱错了