示例工程 23-esm-live-bindings
23-esm-live-bindings/01-live-bindings/README.md
点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。
# 01 · live-bindings
**演示**:ESM 的 `import { count }` 是活绑定,`increment()` 之后读到的就是 1;产物保留 `import`。
**运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开
`http://localhost:8080/examples/23-esm-live-bindings/01-live-bindings/`;开 Console。
**预期控制台输出**:
```text
before:0
after:1
```
**类型检查**:`node node_modules/typescript/bin/tsc -p examples/23-esm-live-bindings/01-live-bindings/tsconfig.types.json`
**注意**:导入绑定是只读的;不能在导入方给 `count` 赋值。