Closed ivanzwb closed 1 year ago
Add "type": "module"
in your package.json
file. zip.js
was not designed for Node.js. It just turned out that as time passed, Node.js became more and more compatible with zip.js
. That is why it does not offer CommonJS support.
When import zip.js in Typescript project.
import { ZipReader, ZipWriter } from '@zip.js/zip.js';
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: [node_modules@zip.js](mailto:node_modules@zip.js)\zip.js\index.js require() of ES modules is not supported.
Can we support the commonjs module as well?
We can use tsimportlib to do async import for commonjs
I'm moving this issue to the Discussions tab because CommonJS support in zip.js is not planned but we can discuss it if needed.
When import zip.js in Typescript project.
import { ZipReader, ZipWriter } from '@zip.js/zip.js';
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: \node_modules\@zip.js\zip.js\index.js require() of ES modules is not supported.
Can we support the commonjs module as well?