// bundle.ts
// @ts-ignore
import { hello } from './hello.ts'
// @ts-ignore
import { button } from './button.ts'
document.addEventListener('DOMContentLoaded', () => {
hello()
button()
})
deno bundle bundle.ts bundle.js
error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.
因此我tsconfig.json
在项目的根目录中添加了一个:
{
"compilerOptions": {
"strict": true,
"lib": ["ES2019", "dom"]
}
}
我仍然收到同样的错误:
error TS2584: Cannot find name 'document'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.
我去寻找答案,并根据这个合并的拉取请求,看起来我需要添加--config tsconfig.json
到命令中。
deno bundle bundle.ts bundle.js --config tsconfig.json
error: Found argument '--config' which wasn't expected, or isn't valid in this context
Deno 版本:0.31.0