Describe the bug
We are using svelte kit to build a frontend that uses the zilliqa-js library. Svelte kit uses vite to build the website and has a common-js plugin which converts commonjs imports to esm but when you mix both require and ecmascript imports it cannot handle it. The error we get is require is not defined since the bundler does not convert the require to an import. I have tried multiple different ways to try and get vite/rollup to transform only this package without success.
The zilliqa-js/crypto library should try to implement the elliptic package with an import instad of require
Additional context
I've read the code and see that this is needed due to the type declarations around elliptic but there must be some other workaround for this hopefully? Maybe it is possible to implement custom type declarations?
Describe the bug We are using svelte kit to build a frontend that uses the zilliqa-js library. Svelte kit uses vite to build the website and has a common-js plugin which converts commonjs imports to esm but when you mix both require and ecmascript imports it cannot handle it. The error we get is
require is not defined
since the bundler does not convert the require to an import. I have tried multiple different ways to try and get vite/rollup to transform only this package without success.To Reproduce
Go to this repo: https://github.com/Hatzz/zilliqa-js-sveltekit Clone it and follow the instructions in the
README.md
Expected behavior
The
zilliqa-js/crypto
library should try to implement theelliptic
package with animport
instad ofrequire
Additional context
I've read the code and see that this is needed due to the type declarations around
elliptic
but there must be some other workaround for this hopefully? Maybe it is possible to implement custom type declarations?