引用依赖报错 has no exported member 'default'

export { default as dayjs } from "https://esm.sh/dayjs";

导出之后在其他地方直接使用 import { dayjs } from ‘deps.ts’ 引入。
之前版本这样引用不会报错,升级deno后,会抛出个错误

error: TS2305 [ERROR]: Module ‘“https://cdn.esm.sh/v54/dayjs@1.10.7/index.d.ts”’ has no exported member ‘default’.
export { default as dayjs } from “https://esm.sh/dayjs”;

不知道应该如何修改消除错误?

export { dayjs } from "https://esm.sh/dayjs";

这样会提示错误,执行的时候也报错

‘“https://esm.sh/dayjs”’ has no exported member named ‘dayjs’. Did you mean ‘Dayjs’?deno-ts(2724)

改成提示的Dayjs,执行的时候会报错

Uncaught SyntaxError: The requested module ‘https://esm.sh/dayjs’ does not provide an export named ‘Dayjs’

我刚试了一下最新的 3 个版本,

export { default as dayjs } from "https://esm.sh/dayjs";

这个是可以的。deno 1.16.11.16.21.16.3

奇怪,我拿另一台电脑升级到最新的是不会了,周一我拿之前那电脑试试,那台好像是1.15.0的

我升级之后就正常了,vscode和deno compile命令都不报错了。之前的版本是1.15.0的

1 个赞