Closed dvinubius closed 2 years ago
The only solution I was able to find involves changing code in the react-moralis dependency itself. I found it because of a developer with Vue-Vite having this issues with another dependency.
packages/vite-app-ts/node_modules/react-moralis/lib/index.esm.js
import MoralisImport from 'moralis';
to import MoralisImport from 'moralis/dist/moralis.js';
I suppose we can close the issue, especially since it's not exactly a scaffold eth issue.
But then this may happen to future builders too when using certain 3rd party code...
Stale issue message
@dvinubius there's a nextjs folder and build now in scaffold-eth-typescript. that might solve this issue.
I think its because of how they bundled their package, they probably default to cjs, which is normal
thanks for investigating @dvinubius
Thank you @ShravanSunder for the fix!
I'm using Moralis as a backend for a Meta MultiSig Factory App.
One of the dependencies is
react-moralis
, which in turn uses themoralis
, which in production throws an error.I suspect that this is due to how vite builds the app for production.
I've searched for this particular issue and could not find it related to Moralis specifically, but I did find it related to Vue and Rollup. However, none of the solutions there were applicable.
So I have little hope that the Moralis people will be able to solve this, but @ShravanSunder I know you've given quite a bit of thought to the vite config and the bundling process. So - here it is:
Issue Description
The app works in local development.
But when served as a production bundle it throws the following exception
Here is the stack trace
This is my code in
useMultiSigSafes.tsx
:This is in
Cloud.js
line 98:This is also
Cloud.js
line 171:This is
encode.js
line 149:This is
encode.js
line 65:This is my
vite.config.ts
: