-
Notifications
You must be signed in to change notification settings - Fork 114
Description
I'm trying to integrate chopsticks in a dApp so that we can run in a mocked environment.
I'm following the example at packages/web-test, but when I do yarn dev, it seems vite can't load the worker browser-wasm-executor.js, so the chain doesn't load.
The browser shows a 404 on http://localhost:5173/node_modules/.vite/deps/browser-wasm-executor.js?worker_file&type=module
Vite shows the following warning:
The file does not exist at "node_modules/.vite/deps/browser-wasm-executor.js?worker_file&type=module" which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding it to
optimizeDeps.exclude. (x2)
This comes from the worker import new URL('browser-wasm-executor.js', import.meta.url) in core/wasm-executor/browser-worker. I tried adding @acalanetwork/core to optimizeDeps.exclude, but that results in another error for some reason where polkadotjs can't load the bn.js library.
Building the project with yarn vite build and then running with yarn preview does work. Only happens when running with yarn dev.
(Also, packages/web-test does work fine, but not sure why I can't get it to work outside of chopsticks' repo).
To reproduce, I just created a new react-ts project with vite, installed all the dependencies that web-test has and copy-pasted the App.tsx. Repo here: https://github.com/voliva/chopsticks-web-test
Is there any configuration setting I'm missing?