| 1 | import OpenCCDefault, { OpenCC } from './opencc.mjs'; |
| 2 | |
| 3 | if (OpenCCDefault !== OpenCC) { |
| 4 | throw new Error('ESM default export does not match named OpenCC export'); |
| 5 | } |
| 6 | |
| 7 | const converter = new OpenCC('s2t.json'); |
| 8 | const result = await converter.convertPromise('汉字'); |
| 9 | |
| 10 | if (result !== '漢字') { |
| 11 | throw new Error(`Unexpected ESM conversion result: ${result}`); |
| 12 | } |