迁移到 EMS

参考:Pure ESM package (opens in a new tab)

步骤

  1. package.json 中的 type 改为 module
  2. tsconfig.json配置参考
{
  "compilerOptions": {
    "target": "ESNext",
    "module": "Node16",
    "moduleResolution": "Node16",
    "esModuleInterop": true,
    "outDir": "./dist",
    "removeComments": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}
  1. 修改 import 语句的后缀,都需要以.js结尾